   (let [network-flows (if (network-flow-types name)
                         (make-network-flows name flow-characteristics arguments)
                         network-flows)]
+    (if-not pclass
+      (throw (Exception. (str "htn-task constructed w/o pclass: name" name))))
     (update-htn-object!
      (assoc-if (htn-object {:prefix prefix :uid uid :ancestry-path ancestry-path})
                :type :htn-task

                       (do
                         (dbg-println :error "ERROR, not currently supported plant-fn type=" type)
                         nil))
        pclass-ctor_ (if (= (:type pclass-ctor_) :arg-reference)
                       (let [param (:name pclass-ctor_)]
                         (first (filter #(= (:param %) param) pargs)))
                       pclass-ctor_)
        ;; pclass-ctor_ (cond
        ;;                (= pclass ::unknown) ;; matching method in pargs?
        ;;                ;; (let [plant-fn_ (get-in ir irks)

;;         :args args}]
;; (assoc ir 'root-task rt)))

(defn get-pclass-for-field [ir mpclass field]
  ;;If the :initial map is an :arg-reference, then there is
  ;;no :pclass available and plant-class will be nil.  However, at
  ;;this point, we don't yet have a root task, so we can't expand
  ;;the :arg-reference
  (let [initial_ (get-in ir [mpclass :fields field :initial])]
    (case (:type initial_)
      :pclass-ctor (:pclass initial_)

      :arg-reference
      (let [arg (:name initial_)
            arg-position (vec-index-of (get-in ir [mpclass :args]) arg)
            all-pclasses (keys ir)]
        (loop [pclasses [] pc (first all-pclasses) more (rest all-pclasses)]
          (if-not pc
            (if (= (count pclasses) 1)
              (first pclasses)
              :unknown-pclass)
            (let [pclass (if (not= pc mpclass) pc)
                  fields (if pclass (keys (get-in ir [pclass :fields])))
                  pcs (vec (remove nil? (mapv
                                         #(let [initial (get-in ir [pclass :fields % :initial])
                                                ctor-arg (if (and (= (:type initial) :pclass-ctor)
                                                                  (= (:pclass initial) mpclass))
                                                           (get (:args initial) arg-position))]
                                            (if ctor-arg
                                              (get-in ir [pclass :fields (keyword ctor-arg) :initial :pclass])))
                                         fields)))
                  pclasses (if (not (empty? pcs))
                             (concatv pclasses pcs)
                             pclasses)
                  pc (first more)
                  more (rest more)]
              (recur pclasses pc more)))))
      :unknown-pclass)))



;; will return subtasks, if any
;; irks are the ks to get-in the ir for the method in question (initially nil)
(defn get-htn-method-subtasks [ir pargs top-level-type mpclass mname display-name margs sub-body irks]
