Fork me on GitHub
#datomic
<
2017-11-16
>
thomas09:11:15

Hi, I am getting a :db.error/not-an-entity Unable to resolve entity: error and I have no idea how to debug this 😇, where should I start looking?

thomas09:11:29

any pointers would be greatly appreciated. TIA

dominicm10:11:29

@thomas that usually means you're trying to resolve something that doesn't exist. e.g. a typo'd entity name in [:some-id "Fobar"]

thomas10:11:18

so this this doesn't exist: Unable to resolve entity: {:order-no 1, :text "XS"}?

dominicm10:11:52

You might have that in the wrong place I suppose? Does your code look like: [:db/add ?e :some/param {order-no …}]

thomas10:11:43

this is the full error as I get it: :message :db.error/not-an-entity Unable to resolve entity: {:order-no 1, :text "XS"} in datom [17592186047266 :choice/options {:order-no 1, :text "XS"}]

thomas10:11:20

not sure if there is an :db/add somewhere (can see that one in my data at least)

dominicm10:11:55

Yeah, it definitely looks like you're setting the value of something to a map?

dominicm10:11:16

Are you transacting a map like this:

{:foo/bar {:order-no 1 …}}
?

thomas10:11:04

I am transacting a massive map of things I think (I didn't write the code nor do I really understand it either, sorry)

conan10:11:34

do you definitely have attributes called :order-no and :text?

thomas10:11:02

let me check.

conan10:11:26

this is handy

(defn print-db-schema
  "Prints all the attributes from :db.install/attribute"
  [db]
  (clojure.pprint/pprint
    (map #(->> % first (d/entity db) d/touch)
      (d/q '[:find ?v
             :where [_ :db.install/attribute ?v]]
        db))))

thomas10:11:52

I think so... let me check something else...

rauh10:11:19

You can't add new data in the value position of a [:db/add ...]. You must look it up with a lookup ref. Like so: [:db/add e a [:order-no 1]]

rauh10:11:35

If you also want to transact new data then you can either use a tempid or a backwards ref

thomas10:11:47

the problem is not perse in the DB... in this App we read in a Excel spreadsheet and use the data in that as well.. and the Excel spreadsheet is the only thing that has changed... and that has resulted in this error... I am looking at the excel at the moment for the text XS and see of that has changed.

thomas10:11:38

and there has been indeed a change there!

rauh10:11:46

Option instead of: - [17592186047266 :choice/options {:order-no 1, :text "XS"}] use: - {:order-no 1, :text "XS", :choice/_options 17592186047266}

thomas10:11:54

ok I am pretty sure I have found the cause of this problem. nothing datomic related...

thomas10:11:36

and thank you for all your help. It certainly helped me point in the right direction and told me what I had to look for in the Excel spreadsheets!!!

conan14:11:50

What's the value of using Datomic's :db.type/uri instead of putting a string in there? The only thing I'll ever do when pulling the data out again is to put it into cemerick/url which is happy with strings

augustl14:11:38

I have the same approach to UUIDs, seems wildly more convenient to just use a string since most of the time the UUID comes from a URL and is a string anyway. And then I don't have to convert it to an UUID, return 404 instead of 500 in my web API if it's an invalid UUID, etc

conan14:11:52

yep, that was my thinking. like how i used to put longs in SQL dbs to represent timestamps (as ms since the epoch) instead of using built-in timestamp types

favila16:11:57

I always use the types because types.

favila16:11:04

UUIDs do have a more compact representation in datomic (really fressian) than strings. But for URIs there is really no difference except type.

mpenet16:11:18

date types in dbs are my pet peeve

favila16:11:34

yeah, java util date is just not enough

mpenet16:11:48

so fun converting that stuff back and forth to no end

favila16:11:25

I have a (still unrealized) plan to encode all the xsd date and time types into a long with canonical sorting

favila16:11:44

we really hurt for "vague human" date types

favila16:11:25

e.g. LocalDate LocalTime LocalDateTime, etc. where there is no time zone and it's not timestamp-resolution

favila16:11:37

or sometimes where there is a zone, but it's not timestamp resolution

favila16:11:22

we encoded dates (i.e. Y-M-D values) into a java util date, and that was a huge mistake. we should have just used strings

favila16:11:31

we were promised custom datatypes in datomic eventually. does anyone know how that is progressing?

matthavener16:11:05

Anyone know if this is expected behavior?

matthavener16:11:26

(d/q '[:find [(pull ?e [:some/attr]) ?e] :where [?e :some/attr]] db)

matthavener16:11:34

ArrayIndexOutOfBoundsException   [trace missing]

matthavener16:11:58

whereas.. something like this works fine:

matthavener16:11:13

(d/q '[:find [(pull ?e [:some/attr]) ?tx] :where [?e :some/attr _ ?tx]] db)

marshall16:11:45

@matthavener Yes, that is a known behavior; you can’t get both e and a pull on e in the same find spec

matthavener16:11:55

interesting! Thank you

marshall16:11:57

you can, however pull both :some/attr and :db/id if you need to

thosmos18:11:24

I'm having troubles connecting console to my local datomic-pro running with a mysql storage. I'm using the following command from the datomic directory:

bin/console -p 8888 dev datomic:sql://\?jdbc:
I can use this same URI (with the addition of the DB name) to connect from a peer and query data. If I put the URI in quotes and remove the escapes it still doesn't work. Here's the error message: https://imgur.com/a/kf3i0 Any ideas?

favila18:11:47

mysql lib may not be on classpath

foobar18:11:40

console live datomic:sql://\?jdbc:postgresql://${docker_postgres_datomic_host}:${docker_postgres_datomic_port}/${docker_postgres_datomic_db}\?user=${docker_postgres_datomic_user}\&password=${docker_postgres_datomic_pass}

thosmos18:11:40

@favila the mysql lib is in the lib folder and the transactor connects successfully? does it need to be somewhere else?

favila18:11:43

logs or console may have a better error message

favila18:11:52

no, that should be enough

foobar18:11:04

Are you missing the mysql db ?

thosmos18:11:50

@foobar that was it! duh!

thosmos18:11:17

i assumed it worked like the peer

fenton19:11:17

trying to setup health checking datomic using ping-host/ping-port configuration, but getting following stacktrace error: bin/transactor ~/projects/abraxas/transactor/config/dev-transactor.properties Launching with Java options -server -Xms1g -Xmx1g -XX:+UseG1GC -XX:MaxGCPauseMillis=50 Critical failure, cannot continue: Error starting transactor java.lang.RuntimeException: Unable to start ping endpoint localhost:9999 at datomic.transactor_ext$start_ping_endpoint.invokeStatic(transactor_ext.clj:42) at datomic.transactor_ext$start_ping_endpoint.invoke(transactor_ext.clj:25) at datomic.transactor_ext$start_pro.invokeStatic(transactor_ext.clj:63) at datomic.transactor_ext$start_pro.invoke(transactor_ext.clj:59) at clojure.lang.Var.invoke(Var.java:379) at datomic.transactor$run_STAR_.invokeStatic(transactor.clj:294) at datomic.transactor$run_STAR_.invoke(transactor.clj:220) at datomic.transactor$run$fn__23373.invoke(transactor.clj:347) at clojure.core$binding_conveyor_fn$fn__6757.invoke(core.clj:2020) at clojure.lang.AFn.call(AFn.java:18) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalStateException: Insufficient threads: max=3 < needed(acceptors=1 + selectors=2 + request=1) at org.eclipse.jetty.server.Server.doStart(Server.java:368) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at cognitect.http_endpoint.jetty$start.invokeStatic(jetty.clj:123) at cognitect.http_endpoint.jetty$start.invoke(jetty.clj:120) at cognitect.http_endpoint.jetty$server$fn__21184.invoke(jetty.clj:136) at cognitect.http_endpoint$create_endpoint.invokeStatic(http_endpoint.clj:292) at cognitect.http_endpoint$create_endpoint.invoke(http_endpoint.clj:217) at cognitect.nano_impl.server$create.invokeStatic(server.clj:172) at cognitect.nano_impl.server$create.invoke(server.clj:141) at cognitect.nano_impl$create.invokeStatic(nano_impl.clj:166) at cognitect.nano_impl$create.invoke(nano_impl.clj:96) at datomic.transactor_ext$start_ping_endpoint.invokeStatic(transactor_ext.clj:33) ... 13 more

marshall19:11:37

@fenton what version of datomic?

fenton19:11:01

@marshall datomic-pro-0.9.5561.62

marshall19:11:14

is something else using that port on your machine?

marshall19:11:39

hrm. hang one

marshall19:11:15

that insufficient thread bug should have been fixed in http://docs.datomic.com/changes.html#0.9.5561.59

fenton19:11:00

@marshall yet i'm on the later version...hmmm...

fenton19:11:16

regression?

fenton19:11:40

i am running in dev mode...

fenton19:11:47

config follows:

marshall19:11:57

@fenton can you email <mailto:[email protected]|[email protected]> with your issue and your config files (redacted of any sensitive info) as well as the number of cores on your system (real & virtual)

marshall19:11:50

i.e. getconf _NPROCESSORS_ONLN

marshall19:11:05

or the contents of /proc/cpuinfo if you’re in linux

fenton19:11:14

@marshall ok will do thx.