This is weird: I've stopped being able to link my code buffers with my cljs repl buffer; sesman-link-with-buffer doesn't help (the buffer says 'Not connected'). Inspection revealed that cider-repl-cljs-upgrade-pending is set to t in said cljs repl, but why would it be so I cannot fathom. I haven't upgraded CIDER in a while; I'm on cider-20260116.1514 from melpa. Any ideas?
I've been experiencing something similar. Leiningen and Shadow-cljs project, using cider-jack-in-clj , and npx shadow-cljs watch with cider-connect-cljs. Cider version is 20260523.212.
When I visit the cljs repl buffer, any cljs buffer is associated with that repl and cider-switch-to-repl-buffer works as you'd expect, while any clj buffer becomes [not connected] and switching to the repl buffer stops working. Vice-versa, if I then visit the clj repl buffer, the clj buffers become connected as normal, but the cljs buffers disconnect.
I didn't look into the nREPL middleware part or the reproduction yet, but fwiw I've managed to work around the issue with sesman-link-with-directory which seems to stick for the rest of the session. I actually came here now to ask if this is potentially a bug, or if I have perhaps misconfigured something as I'm pretty much a complete newbie with Emacs. Let me know if there's any more info I could provide.
I've added a workaround to the issue above
I'm reasonably sure you've hit a bug in Orchard. See https://github.com/clojure-emacs/orchard/pull/396/changes
I'm guessing that's some relatively recent regression, as I doubt something changed upstream in ClojureScript.
A ha, that sounds like it
Thank you!
I tried manually setting that variable back to nil:
(with-current-buffer (cadar (sesman-current-sessions 'CIDER))
(setq cider-repl-cljs-upgrade-pending nil))
This unblocked linking the buffer, but now attempting to evaluate things in the REPL buffer throws this (but it still prints the evaluation result):
ERROR: Unhandled REPL handler exception processing message {:id 33, :op cider/get-state, :session 4371bd9e-f3cb-410d-b568-86dfafbbc239}
java.lang.ClassCastException: class clojure.lang.Symbol cannot be cast to class java.util.List (clojure.lang.Symbol is in unnamed module of loader 'app'; java.util.List is in module java.base of loader 'bootstrap')
at orchard.indent$find_idx.invokeStatic(indent.clj:107)
at orchard.indent$find_idx.invoke(indent.clj:106)
at orchard.indent$compute_style_indent.invokeStatic(indent.clj:120)
at orchard.indent$compute_style_indent.invoke(indent.clj:110)
at orchard.indent$infer_style_indent.invokeStatic(indent.clj:164)
at orchard.indent$infer_style_indent.invoke(indent.clj:151)
at cider.nrepl.middleware.track_state$ns_state$post_process__64337$fn__64338.invoke(track_state.clj:217)
at orchard.misc$update_vals$fn__26146.invoke(misc.clj:85)
at clojure.lang.PersistentHashMap$NodeSeq.kvreduce(PersistentHashMap.java:1309)
at clojure.lang.PersistentHashMap$BitmapIndexedNode.kvreduce(PersistentHashMap.java:804)
at clojure.lang.PersistentHashMap$ArrayNode.kvreduce(PersistentHashMap.java:468)
at clojure.lang.PersistentHashMap.kvreduce(PersistentHashMap.java:238)
at clojure.core$fn__8559.invokeStatic(core.clj:6987)
at clojure.core$fn__8559.invoke(core.clj:6967)
at clojure.core.protocols$fn__8287$G__8282__8296.invoke(protocols.clj:174)
at clojure.core$reduce_kv.invokeStatic(core.clj:6998)
at clojure.core$reduce_kv.invoke(core.clj:6989)
at orchard.misc$update_vals.invokeStatic(misc.clj:84)
at orchard.misc$update_vals.invoke(misc.clj:81)
at cider.nrepl.middleware.track_state$ns_state$post_process__64337.invoke(track_state.clj:216)
at cider.nrepl.middleware.track_state$ns_state.invokeStatic(track_state.clj:225)
at cider.nrepl.middleware.track_state$ns_state.invoke(track_state.clj:205)
at cider.nrepl.middleware.track_state$ns_state.invokeStatic(track_state.clj:232)
at cider.nrepl.middleware.track_state$ns_state.invoke(track_state.clj:205)
at cider.nrepl.middleware.track_state$merge_used_aliases$fn__64353$fn__64355.invoke(track_state.clj:275)
at clojure.lang.PersistentHashMap$NodeSeq.kvreduce(PersistentHashMap.java:1309)
at clojure.lang.PersistentHashMap$BitmapIndexedNode.kvreduce(PersistentHashMap.java:804)
at clojure.lang.PersistentHashMap.kvreduce(PersistentHashMap.java:238)
at clojure.core$fn__8559.invokeStatic(core.clj:6987)
at clojure.core$fn__8559.invoke(core.clj:6967)
at clojure.core.protocols$fn__8287$G__8282__8296.invoke(protocols.clj:174)
at clojure.core$reduce_kv.invokeStatic(core.clj:6998)
at clojure.core$reduce_kv.invoke(core.clj:6989)
at cider.nrepl.middleware.track_state$merge_used_aliases$fn__64353.invoke(track_state.clj:272)
at clojure.lang.PersistentHashMap$NodeSeq.kvreduce(PersistentHashMap.java:1309)
at clojure.lang.PersistentHashMap$BitmapIndexedNode.kvreduce(PersistentHashMap.java:804)
at clojure.lang.PersistentHashMap$ArrayNode.kvreduce(PersistentHashMap.java:468)
at clojure.lang.PersistentHashMap.kvreduce(PersistentHashMap.java:238)
at clojure.core$fn__8559.invokeStatic(core.clj:6987)
at clojure.core$fn__8559.invoke(core.clj:6967)
at clojure.core.protocols$fn__8287$G__8282__8296.invoke(protocols.clj:174)
at clojure.core$reduce_kv.invokeStatic(core.clj:6998)
at clojure.core$reduce_kv.invoke(core.clj:6989)
at cider.nrepl.middleware.track_state$merge_used_aliases.invokeStatic(track_state.clj:271)
at cider.nrepl.middleware.track_state$merge_used_aliases.invoke(track_state.clj:268)
at cider.nrepl.middleware.track_state$calculate_changed_project_state_response.invokeStatic(track_state.clj:313)
at cider.nrepl.middleware.track_state$calculate_changed_project_state_response.invoke(track_state.clj:292)
at cider.nrepl.middleware.track_state$handle_tracker.invokeStatic(track_state.clj:343)
at cider.nrepl.middleware.track_state$handle_tracker.invoke(track_state.clj:341)
at clojure.lang.Var.invoke(Var.java:390)
at cider.nrepl$wrap_tracker$fn__28486.invoke(nrepl.clj:1067)
at cider.nrepl$wrap_version$fn__28504.invoke(nrepl.clj:1095)
at cider.nrepl$wrap_xref$fn__28512.invoke(nrepl.clj:1105)
at shadow.cljs.devtools.server.nrepl$shadow_init$fn__24635.invoke(nrepl.clj:28)
at shadow.cljs.devtools.server.nrepl_impl$handle.invokeStatic(nrepl_impl.clj:334)
at shadow.cljs.devtools.server.nrepl_impl$handle.invoke(nrepl_impl.clj:225)
at shadow.cljs.devtools.server.nrepl$middleware$fn__24644.invoke(nrepl.clj:46)
at nrepl.middleware.print$wrap_print$fn__23169.invoke(print.clj:187)
at nrepl.middleware.session$session$fn__24414.invoke(session.clj:360)
at refactor_nrepl.middleware$wrap_refactor$fn__29390.invoke(middleware.clj:244)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.lang.AFunction$1.doInvoke(AFunction.java:33)
at clojure.lang.RestFn.invoke(RestFn.java:411)
at shadow.cljs.devtools.server.nrepl$start$fn__24676.invoke(nrepl.clj:148)
at nrepl.server$handle_STAR_.invokeStatic(server.clj:27)
at nrepl.server$handle_STAR_.invoke(server.clj:24)
at nrepl.server$handle$reify__24442.run(server.clj:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)Digging into this a bit more (with LLM assistance), it looks like Orchard is barfing on some code from taoensso/encore . At some point, it tries to evaluate orchard.indent/infer-style-indent with this input:
{:macro true,
:arglists '([ctx & body]),
:doc
"Evaluates given body with given `*ctx*` value. See `*ctx*` for details.",
:top-fn
{:variadic? true,
:fixed-arity 1,
:max-fixed-arity 1,
:method-params ((ctx body)),
:arglists ([ctx & body]),
:arglists-meta (nil)},
:file nil,
:fn true}
Which fails with the cited stacktrace. Now, that Encore code is a weird macro-writing macro that apparently produces an arglist with one too many levels of quoting, that orchard then chokes on.
Indeed, this throws (Orchard 0.41):
(orchard.indent/infer-style-indent {:arglists ''([ctx & body])})
But this works:
(orchard.indent/infer-style-indent {:arglists '([ctx & body])})Think this is not a bug in Encore after all, but somewhere in CIDER or one of its dependencies. @bozhidar I've created a minimal repro https://github.com/nathell/cider-cljs-issue. I've verified I can reproduce it on a fresh Docker ubuntu container
@dj942 Can you summarize all of this in a GitHub issue? I'll investigate later what's going on there.
Sure, will do!
@dgtized could it be the same issue that you were running into?
@bozhidar reported as https://github.com/clojure-emacs/cider/issues/3923 – hope it's clear. AMA if not
Much delayed response @dj942, but just confirmed that your workaround resolved the issue with the latest cider release, but that the bug is still present as I'm guessing cider is still using the previous release of orchard. Thanks for tracking that down and creating the workaround!
Yeah, I totally forget to cut a new orchard/cider-nrepl release when I fixed this there. facepalm
I've pushed out new versions of cider-nrepl and orchard for the CIDER snapshot, so please try again with it. I hope the issue if finally solved for everyone.
Confirmed that with cider <tel:202606191544|20260619.1544> clojurescript buffers are again associating with the repl session. Thanks @bozhidar!
You're welcome! Sorry for that regression and for the time it took me to fix it properly!