Lookup Ref is interpreted as a tempid String, resulting in "tempid _ used only as value in transaction"

I’d like to use a Lookup Ref as the identifier for a ref in a new entity transaction. But datomic thinks the ref is a “tempid” string rather than recognizing it as a lookup ref.

Here is a sample transaction:

(d/transact conn {:tx-data [{:db/id             "new"
                             :booking/inventory [:style/id "deleteme"]
                             :booking/status    :booking-status/cancelled
                             }]})

The error I get is:

Execution error (ExceptionInfo) at datomic.client.api.async/ares (async.clj:58).
tempid ‘deleteme’ used only as value in transaction

Here’s the relevant bit of the schema:

#:db{:id 75,
      :ident :style/id,
      :valueType :db.type/string,
      :cardinality :db.cardinality/one,
      :unique #:db{:id 38, :ident :db.unique/identity},
      :doc "The ID ..."}
#:db{:id 87,
      :ident :booking/inventory,
      :valueType :db.type/ref,
      :cardinality :db.cardinality/many,
      :doc "The ..."}

The specified style/id does exist, and, in fact, this lookup ref works with a pull:

(d/pull (d/db conn) '[*] [:style/id "deleteme"])
=> {:db/id 79164837199968, :style/id "deleteme"}

Any ideas on why this is not working for me?

-Marc

Is :booking/inventory a multi-arity attribute? If so, you need to wrap the reference tuple
[:style/id "deleteme"] in some collection (a set or vector), or it will reference the attribute entity identified as :style/id as well as the non-existent tempid "deleteme".

Ah, :booking/inventory is, indeed, multi-arity. So that explains my situation. Thanks for that clarification.