clojurescript 2025-08-28

I noticed in a barebones cljs project with a src/demo/core.cljs and this deps.edn

{:deps  {org.clojure/clojure       {:mvn/version "1.12.1"}
         org.clojure/clojurescript {:mvn/version "1.12.42"}
         com.datomic/local {:mvn/version "1.0.291"}}}
I get an error when I try to run a cljs repl with:
clj -M -m cljs.main --compile demo.core --repl

Execution error (ClassCastException) at cljs.util/mkdirs (util.cljc:141).
class java.net.URL cannot be cast to class java.io.File (java.net.URL and java.io.File are in module java.base of loader 'bootstrap')
...
(see 🧵 for full error and deps tree) This seems to be related to the transtitive dependency in datomic local on transit-java. If I add :exclusions [com.cognitect/transit-java] the repl command works properly Is this a bug in clojurescript? or just an expected edge case of the way tools.deps resolution works?

Full error:

{:clojure.main/message
 "Execution error (ClassCastException) at cljs.util/mkdirs (util.cljc:141).\nclass java.net.URL cannot be cast to class java.io.File (java.net.URL and java.io.File are in module java.base of loader 'bootstrap')\n",
 :clojure.main/triage
 {:clojure.error/class java.lang.ClassCastException,
  :clojure.error/line 141,
  :clojure.error/cause
  "class java.net.URL cannot be cast to class java.io.File (java.net.URL and java.io.File are in module java.base of loader 'bootstrap')",
  :clojure.error/symbol cljs.util/mkdirs,
  :clojure.error/source "util.cljc",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.ExceptionInfo,
    :message "Unexpected error during REPL initialization",
    :data {:cljs.repl/error :init-failed},
    :at [cljs.repl$repl_STAR_ invokeStatic "repl.cljc" 1222]}
   {:type java.lang.ClassCastException,
    :message
    "class java.net.URL cannot be cast to class java.io.File (java.net.URL and java.io.File are in module java.base of loader 'bootstrap')",
    :at [cljs.util$mkdirs invokeStatic "util.cljc" 141]}],
  :trace
  [[cljs.util$mkdirs invokeStatic "util.cljc" 141]
   [cljs.util$mkdirs invoke "util.cljc" 141]
   [cljs.analyzer$write_analysis_cache
    invokeStatic
    "analyzer.cljc"
    4801]
   [cljs.analyzer$write_analysis_cache invoke "analyzer.cljc" 4797]
   [cljs.analyzer$analyze_file invokeStatic "analyzer.cljc" 4938]
   [cljs.analyzer$analyze_file invoke "analyzer.cljc" 4878]
   [cljs.analyzer$analyze_file invokeStatic "analyzer.cljc" 4942]
   [cljs.analyzer$analyze_file invoke "analyzer.cljc" 4878]
   [cljs.analyzer$analyze_file invokeStatic "analyzer.cljc" 4892]
   [cljs.analyzer$analyze_file invoke "analyzer.cljc" 4878]
   [cljs.compiler$with_core_cljs invokeStatic "compiler.cljc" 1477]
   [cljs.compiler$with_core_cljs invoke "compiler.cljc" 1467]
   [cljs.repl$repl_STAR_ invokeStatic "repl.cljc" 1125]
   [cljs.repl$repl_STAR_ invoke "repl.cljc" 1033]
   [cljs.cli$repl_opt invokeStatic "cli.clj" 325]
   [cljs.cli$repl_opt invoke "cli.clj" 312]
   [cljs.cli$default_compile invokeStatic "cli.clj" 542]
   [cljs.cli$default_compile invoke "cli.clj" 494]
   [cljs.cli$compile_opt invokeStatic "cli.clj" 553]
   [cljs.cli$compile_opt invoke "cli.clj" 548]
   [cljs.cli$main invokeStatic "cli.clj" 744]
   [cljs.cli$main doInvoke "cli.clj" 733]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$apply invoke "core.clj" 662]
   [cljs.main$_main invokeStatic "main.clj" 65]
   [cljs.main$_main doInvoke "main.clj" 56]
   [clojure.lang.RestFn applyTo "RestFn.java" 140]
   [clojure.lang.Var applyTo "Var.java" 707]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.main$main_opt invokeStatic "main.clj" 515]
   [clojure.main$main_opt invoke "main.clj" 511]
   [clojure.main$main invokeStatic "main.clj" 665]
   [clojure.main$main doInvoke "main.clj" 617]
   [clojure.lang.RestFn applyTo "RestFn.java" 140]
   [clojure.lang.Var applyTo "Var.java" 707]
   [clojure.main main "main.java" 40]],
  :cause
  "class java.net.URL cannot be cast to class java.io.File (java.net.URL and java.io.File are in module java.base of loader 'bootstrap')"}}
deps tree:
org.clojure/clojure 1.12.1
  . org.clojure/spec.alpha 0.5.238
  . org.clojure/core.specs.alpha 0.4.74
org.clojure/clojurescript 1.12.42
  . com.google.javascript/closure-compiler v20250402
  . org.clojure/google-closure-library 0.0-20250515-f04e4c0e
    . org.clojure/google-closure-library-third-party 0.0-20250515-f04e4c0e
  X com.cognitect/transit-java 1.0.362 :superseded
    . com.fasterxml.jackson.core/jackson-core 2.8.7
    . org.msgpack/msgpack 0.6.12
      . com.googlecode.json-simple/json-simple 1.1.1
      . org.javassist/javassist 3.18.1-GA
    . javax.xml.bind/jaxb-api 2.3.0
  . org.clojure/tools.reader 1.3.6
com.datomic/local 1.0.291
  . com.datomic/client 1.0.138
    . com.cognitect/anomalies 0.1.12
    . com.datomic/client-api 1.0.69
    . com.datomic/client-impl-shared 1.0.106
      . com.cognitect/hmac-authn 0.1.211
        . commons-codec/commons-codec 1.16.0
        . com.cognitect/anomalies 0.1.12
        . org.clojure/core.async 1.6.681
      X com.cognitect/http-client 1.0.127 :excluded
      . com.cognitect/transit-clj 1.0.333
        . com.cognitect/transit-java 1.0.371 :newer-version
          X com.fasterxml.jackson.core/jackson-core 2.14.2 :excluded
          . org.msgpack/msgpack 0.6.12
            . com.googlecode.json-simple/json-simple 1.1.1
            . org.javassist/javassist 3.18.1-GA
          . javax.xml.bind/jaxb-api 2.4.0-b180830.0359
            . javax.activation/javax.activation-api 1.2.0
    . com.datomic/query-support 0.8.28
    . org.clojure/core.async 1.6.681
  . com.cognitect/anomalies 0.1.12
  . com.datomic/query-support 0.8.28
  . org.clojure/core.async 1.6.681
    . org.clojure/tools.analyzer.jvm 1.2.3
  . org.clojure/tools.analyzer.jvm 1.2.3
    . org.clojure/tools.analyzer 1.1.1
    . org.clojure/core.memoize 1.0.253
    . org.ow2.asm/asm 9.2
    . org.clojure/tools.reader 1.3.6
  . org.clojure/tools.analyzer 1.1.1
  . org.clojure/core.memoize 1.0.253
    . org.clojure/core.cache 1.0.225
  . org.clojure/core.cache 1.0.225
    . org.clojure/data.priority-map 1.1.0
  . org.clojure/data.priority-map 1.1.0
  . org.ow2.asm/asm 9.2
  . org.clojure/tools.reader 1.3.6
  X org.clojure/spec.alpha 0.2.176 :older-version
  X org.clojure/core.specs.alpha 0.2.44 :older-version
  . com.datomic/client-impl-shared 1.0.106
    . com.cognitect/anomalies 0.1.12
    . org.clojure/core.async 1.6.681
  . commons-io/commons-io 2.15.1
  . com.datomic/query-stats 1.0.12
  . org.fressian/fressian 0.6.8
  . com.github.ben-manes.caffeine/caffeine 2.8.1
    . org.checkerframework/checker-qual 3.1.0
    . com.google.errorprone/error_prone_annotations 2.3.4
  . org.checkerframework/checker-qual 3.1.0
  . com.google.errorprone/error_prone_annotations 2.3.4
  . com.datomic/io-stats 1.0.12
  . com.datomic/client-api 1.0.69
    . org.clojure/core.async 1.6.681

Dunno what transit has to do with anything, there seems to be a bug in CLJS itself - cljs.analyzer/cache-file returns sometimes File and sometimes URL.

what is in demo.core? Is there a link to a full repo?

I put one here: https://github.com/jjttjj/cljs-repro (I can add a better description and dig in a little more tomorrow)