Welcome! Please see the About page for a little more info on how this works.

+1 vote
in ClojureScript by
edited by

Hello! As ever, super-grateful for cljs - it's a huge multiplier on our efforts and we continue to love it as we use it all day long every day.

After upgrading clojurescript versions, we started getting a strange read-string related error: "No reader function for tag uuid."

cljs repl:

ClojureScript 1.10.238
app:cljs.user=> (cljs.tools.reader.edn/read-string "#uuid \"eed86fd1-4110-44d8-8f41-27473029cc6a\"")
#error {:message "No reader function for tag uuid.", :data {:type :reader-exception, :ex-kind :reader-error}}
   new (jar:file:/home/harold/.m2/repository/org/clojure/clojurescript/1.10.238/clojurescript-1.10.238.jar!/cljs/core.cljs:11123:11)
   Function.cljs$core$IFn$_invoke$arity$3 (jar:file:/home/harold/.m2/repository/org/clojure/clojurescript/1.10.238/clojurescript-1.10.238.jar!/cljs/core.cljs:11155:5)
   Function.cljs$core$IFn$_invoke$arity$2 (jar:file:/home/harold/.m2/repository/org/clojure/clojurescript/1.10.238/clojurescript-1.10.238.jar!/cljs/core.cljs:11153:16)
   cljs.core/ex-info (jar:file:/home/harold/.m2/repository/org/clojure/clojurescript/1.10.238/clojurescript-1.10.238.jar!/cljs/core.cljs:11150:1)
   Function.cljs$core$IFn$_invoke$arity$variadic (jar:file:/home/harold/.m2/repository/org/clojure/tools.reader/1.3.3/tools.reader-1.3.3.jar!/cljs/tools/reader/impl/errors.cljs:37:13)
   cljs.tools.reader.impl.errors/throw-ex (jar:file:/home/harold/.m2/repository/org/clojure/tools.reader/1.3.3/tools.reader-1.3.3.jar!/cljs/tools/reader/impl/errors.cljs:26:1)
   Function.cljs$core$IFn$_invoke$arity$variadic (jar:file:/home/harold/.m2/repository/org/clojure/tools.reader/1.3.3/tools.reader-1.3.3.jar!/cljs/tools/reader/impl/errors.cljs:43:4)
   cljs.tools.reader.impl.errors/reader-error (jar:file:/home/harold/.m2/repository/org/clojure/tools.reader/1.3.3/tools.reader-1.3.3.jar!/cljs/tools/reader/impl/errors.cljs:39:1)
   cljs.tools.reader.impl.errors/throw-unknown-reader-tag (jar:file:/home/harold/.m2/repository/org/clojure/tools.reader/1.3.3/tools.reader-1.3.3.jar!/cljs/tools/reader/impl/errors.cljs:221:4)
   cljs$tools$reader$edn$read_tagged (jar:file:/home/harold/.m2/repository/org/clojure/tools.reader/1.3.3/tools.reader-1.3.3.jar!/cljs/tools/reader/edn.cljs:372:10)

app:cljs.user=> (cljs.tools.reader.edn/read-string {:readers {'uuid uuid}} "#uuid \"eed86fd1-4110-44d8-8f41-27473029cc6a\"")
#uuid "eed86fd1-4110-44d8-8f41-27473029cc6a"

clj repl:

> (clojure.edn/read-string "#uuid \"eed86fd1-4110-44d8-8f41-27473029cc6a\"")
#uuid "eed86fd1-4110-44d8-8f41-27473029cc6a"

Previously, reading edn behaved more similarly between cljs and clj. I found the workaround of passing the map as the first argument by looking at the tests in tools.reader.

Is this expected?

Thanks for your time and consideration.

2 Answers

0 votes
by
 
Best answer

The answer is to use clojure.edn instead of cljs.tools.reader.edn:

$ clojure -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.844"}}}' -M -m cljs.main
ClojureScript 1.10.844
cljs.user=> (require 'clojure.edn)
nil
cljs.user=> (clojure.edn/read-string "#uuid \"eed86fd1-4110-44d8-8f41-27473029cc6a\"")
#uuid "eed86fd1-4110-44d8-8f41-27473029cc6a"

I learned a lot. Thank you!

Additional info here at this gist: https://gist.github.com/harold/10dd1ba54332992b4eeab72aa88ef2bd

+1 vote
by

It's a bit hard to understand what is going on here. You have two different old versions of ClojureScript it appears? Note the REPL reported version and then the version reported by the stack trace.

by
Hi! Wow, yeah, that was weird. I started from scratch and put the correct cljs output in the question now. Sorry for the confusion. The behavior is the same. I believe we're getting this version of cljs from reagent 1.0. Would a newer version of cljs behave differently?
by
This issue seems quite trivial to reproduce outside of your project. Can you confirm this still exists in the latest version `1.10.844`.
by
edited by
Great idea, it appears the latest version behaves the same: https://gist.github.com/harold/10dd1ba54332992b4eeab72aa88ef2bd
...