Cryptic Clojure error: java.lang.UnsupportedOperationException: nth not supported on this type: Symbol

StackOverflow https://stackoverflow.com/questions/19127798

  •  30-06-2022
  •  | 
  •  

Question

I am trying to make leiningen work. I am using Windows 7. When I run in the command window

C:\lein new app my-app

I get the following error. Does anyone know what this means and where the error is occuring?

There is an explanation of the error message here but I did not understand if there is a fix or what causes the error.

C:\Users\a\work>lein new app my-app
java.lang.UnsupportedOperationException: nth not supported on this type: Symbol
        at clojure.lang.RT.nthFrom(RT.java:857)
        at clojure.lang.RT.nth(RT.java:807)
        at leiningen.core.project$dep_key.invoke(project.clj:175)
        at leiningen.core.project$reduce_dep_step.invoke(project.clj:183)
        at clojure.lang.ArrayChunk.reduce(ArrayChunk.java:58)
        at clojure.core.protocols$fn__6041.invoke(protocols.clj:98)
        at clojure.core.protocols$fn__6005$G__6000__6014.invoke(protocols.clj:19
)
        at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31)
        at clojure.core.protocols$fn__6024.invoke(protocols.clj:60)
        at clojure.core.protocols$fn__5979$G__5974__5992.invoke(protocols.clj:13
)
        at clojure.core$reduce.invoke(core.clj:6177)
        at leiningen.core.project$meta_merge.invoke(project.clj:391)
        at clojure.core$merge_with$merge_entry__4279.invoke(core.clj:2698)
        at clojure.core$reduce1.invoke(core.clj:896)
        at clojure.core$merge_with$merge2__4281.invoke(core.clj:2701)
        at clojure.core$reduce1.invoke(core.clj:896)
        at clojure.core$reduce1.invoke(core.clj:887)
        at clojure.core$merge_with.doInvoke(core.clj:2702)
        at clojure.lang.RestFn.invoke(RestFn.java:439)
        at leiningen.core.project$meta_merge.invoke(project.clj:395)
        at leiningen.core.project$apply_profiles$fn__1009.invoke(project.clj:417
)
        at clojure.lang.ArrayChunk.reduce(ArrayChunk.java:58)
        at clojure.core.protocols$fn__6041.invoke(protocols.clj:98)
        at clojure.core.protocols$fn__6005$G__6000__6014.invoke(protocols.clj:19
)
        at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31)
        at clojure.core.protocols$fn__6026.invoke(protocols.clj:54)
        at clojure.core.protocols$fn__5979$G__5974__5992.invoke(protocols.clj:13
)
        at clojure.core$reduce.invoke(core.clj:6177)
        at leiningen.core.project$apply_profiles.invoke(project.clj:415)
        at leiningen.core.project$init_profiles.doInvoke(project.clj:603)
        at clojure.lang.RestFn.invoke(RestFn.java:425)
        at leiningen.core.main$_main$fn__1332.invoke(main.clj:257)
        at leiningen.core.main$_main.doInvoke(main.clj:252)
        at clojure.lang.RestFn.invoke(RestFn.java:436)
        at clojure.lang.Var.invoke(Var.java:423)
        at clojure.lang.AFn.applyToHelper(AFn.java:167)
        at clojure.lang.Var.applyTo(Var.java:532)
        at clojure.core$apply.invoke(core.clj:617)
        at clojure.main$main_opt.invoke(main.clj:335)
        at clojure.main$main.doInvoke(main.clj:440)
        at clojure.lang.RestFn.invoke(RestFn.java:482)
        at clojure.lang.Var.invoke(Var.java:431)
        at clojure.lang.AFn.applyToHelper(AFn.java:178)
        at clojure.lang.Var.applyTo(Var.java:532)
        at clojure.main.main(main.java:37)
C:\Users\a\work
Was it helpful?

Solution

As requested, here's my comment transferred into an answer. I suggested reinstalling Leiningen because apparently a broken Leiningen installation was the source of the problem.

As a little background explanation, I'm using Leiningen on both Linux and Windows, and I've made the experience myself that the primary method for installing Leiningen recommended on its homepage, the lein resp. lein.bat script, just works, whereas the alternative installation methods (Linux package managers, Windows installer) often produce broken installations.

OTHER TIPS

I think it's highly unlikely that this is essentially a leiningen error, since I can reproduce it without leiningen being involved in any way:

user=> (let [[foo bar] :froboz] (list foo bar))

UnsupportedOperationException nth not supported on this type: Keyword clojure.lang.RT.nthFrom (RT.java:857)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top