When analyzing a project that uses certain macros that expands to def, clj-kondo's :var-definitions analysis can produce clj_kondo.impl.rewrite_clj.node.token.TokenNode objects instead of plain symbols for the :name field of some entries.
clj-xref.analyze/transform-var-def copies this value as-is into :local-name
In memory, these TokenNode objects work fine — (str token-node) returns the correct string. But when clj-xref.emit/write-edn serializes the database with prn, the TokenNode's print representation is <token: Foo>, which is not valid EDN. This causes clj-xref.emit/read-edn (and therefore clj-xref.core/load-db) to fail:
Execution error at clj-xref.emit/read-edn (emit.clj:56).
Invalid token: <token:
Looks like the one way to fix it is to coerce :local-name to a symbol in transform-var-def:
:local-name (:name vd)
;; to:
:local-name (symbol (str (:name vd)))
When analyzing a project that uses certain macros that expands to def, clj-kondo's :var-definitions analysis can produce clj_kondo.impl.rewrite_clj.node.token.TokenNode objects instead of plain symbols for the :name field of some entries.
clj-xref.analyze/transform-var-defcopies this value as-is into:local-nameIn memory, these TokenNode objects work fine — (str token-node) returns the correct string. But when clj-xref.emit/write-edn serializes the database with prn, the TokenNode's print representation is <token: Foo>, which is not valid EDN. This causes clj-xref.emit/read-edn (and therefore clj-xref.core/load-db) to fail:
Execution error at clj-xref.emit/read-edn (emit.clj:56).
Invalid token: <token:
Looks like the one way to fix it is to coerce
:local-nameto a symbol intransform-var-def: