Skip to content

[Bug]: Useless warnings are printed when using pull API #799

@jonasseglare

Description

@jonasseglare

What version of Datahike are you using?

0.7.1663

What version of Java are you using?

Java(TM) SE Runtime Environment Oracle GraalVM 25+37.1 (build 25+37-LTS-jvmci-b01)

What operating system are you using?

MacOS

What database EDN configuration are you using?

{:attribute-refs? true,
:index :datahike.index/persistent-set,
:keep-history true,
:name "jobtech-taxonomy-db",
:schema-flexibility :write,
:store {:backend :memory
:id #uuid "7dc50266-5d1c-beef-a6f8-badcafe10113"}}

Describe the bug

When using the pull API, e.g.

                     (dc/q '[:find (pull ?edge [:db/id
                                                :mapping.edge/source
                                                :mapping.edge/target
                                                :mapping.edge/mapping])
                             :keys edge
                             :in $ [[?source ?target] ...]
                             :where
                             [?edge :mapping.edge/source ?source]
                             [?edge :mapping.edge/target ?target]]
                           db source-id+target-id-set)

lots of warnings are printed. The warnings come from the function datahike.pull-api/db-ident-and-id which in turn indirectly calls the function datahike.db.interface/-ident-for. The function datahike.pull-api/db-ident-and-id is clearly written in such a way that it expects the ident to sometimes be nil, but datahike.db.interface/-ident-for will always warn if it returns nil even if that nil is expected.

As a consequence, the call to the pull API tends to result in a lot of false-alarm warnings being spammed, e.g.

2026-03-31T13:16:48.081731Z :warn datahike.db :datahike/attribute-ref-not-found 
  data: {:ref 167540}
2026-03-31T13:16:48.081953Z :warn datahike.db :datahike/attribute-ref-not-found 
  data: {:ref 103119}
2026-03-31T13:16:48.082024Z :warn datahike.db :datahike/attribute-ref-not-found 
  data: {:ref 234739}
2026-03-31T13:16:48.082070Z :warn datahike.db :datahike/attribute-ref-not-found 
  data: {:ref 236291}
2026-03-31T13:16:48.082151Z :warn datahike.db :datahike/attribute-ref-not-found 
  data: {:ref 100736}
2026-03-31T13:16:48.082198Z :warn datahike.db :datahike/attribute-ref-not-found 
  data: {:ref 16770}
2026-03-31T13:16:48.082244Z :warn datahike.db :datahike/attribute-ref-not-found 
  data: {:ref 226485}
2026-03-31T13:16:48.082277Z :warn datahike.db :datahike/attribute-ref-not-found 
  data: {:ref 234739}
2026-03-31T13:16:48.082309Z :warn datahike.db :datahike/attribute-ref-not-found 
  data: {:ref 236291}

What is the expected behaviour?

No warnings from using the pull API.

How can the behaviour be reproduced?

Check out this commit: https://gitlab.com/arbetsformedlingen/taxonomy-dev/backend/jobtech-taxonomy-api/-/tree/0fef5f60899aadbf351b798cda6199e0a74c0100

and run clj -M:dev -m dev from the terminal, and you will see the warnings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions