I have a clojurescript project that until recently was working really well developing with Cider, but am now encountering frequent problems where a buffer disconnects from the cider-repl and says [not connected] in the mode line. I haven't diagnosed what action in particular is triggering this, but thought I would bring it up in case anyone else was encountering this with the latest Cider changes. It's certainly possible it's some change on my end (or the recent upgrade to latest ClojureScript), but just curious if anyone else was encountering behavior like this. At least a couple times I have countered this where I opened a buffer, jacked in, and then as soon as it was up it disconnected without any actions on my part. Is anyone aware of a recent change in Cider or ClojureScript that might make things more fragile?
If you come up with a reliable repro - feel free to open an issue. I've been doing some broad refactorings recently, so it's possible I broke something, although nothing cljs-specific.
thank you, no rush, just wanted to make sure it was still a known issue
Guessing just an oversight, but that fix for #3909 didn't address the problem, can we re-open the issue, I don't have permissions.
I’ll revisit it again soon. There are quite a bit of moving parts there, but I’ve also been doing a major push to decouple of simplify some of the internals (jack-in included).
I've got a couple projects that use figwheel, three of them startup and then instantly disconnect, and one that does successfully connect each buffer to the repl. I'm trying to figure out what's different about the one that is working from the 3 that are not. Example repo that is working is: https://github.com/dgtized/tile-game, and it immediately disconnects for https://github.com/dgtized/shimmers and https://github.com/dgtized/sierpinski-sieve. The first project this broke on (shimmers) I had also upgraded clojurescript, but that was not the case for the other two and I witnessed the same behavior. For the one that works (tile-game) I was able to upgrade to latest clojurescript, so it does not appear to be the source of the issue. Finally, I usually install Cider from MELPA and was running version 20260510.755. I tried downgrading to 1.21.0 and it started working on all projects. When I reverted back to the MELPA release it stopped working again. I'm not sure what else changed in there but I see from the commandline that MELPA is running with:
[nREPL] Starting server via /usr/local/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.7.0\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.59.0\"\}\ refactor-nrepl/refactor-nrepl\ \{\:mvn/version\ \"3.11.0\"\}\ cider/piggieback\ \{\:mvn/version\ \"0.6.1\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[refactor-nrepl.middleware/wrap-refactor\,cider.nrepl/cider-middleware\,cider.piggieback/wrap-cljs-repl\]\"\]\}\}\} -M:dev:cider/nrepl
and
1.21.0 is running with
[nREPL] Starting server via /usr/local/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.5.2\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.58.0\"\}\ refactor-nrepl/refactor-nrepl\ \{\:mvn/version\ \"3.11.0\"\}\ cider/piggieback\ \{\:mvn/version\ \"0.6.1\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[refactor-nrepl.middleware/wrap-refactor\,cider.nrepl/cider-middleware\,cider.piggieback/wrap-cljs-repl\]\"\]\}\}\} -M:dev:cider/nrepl
I suspect 1.21.0 is pretty far back given the difference in nrepl and the like.
So TLDR, it's definitely from a change in Cider, but there might also be a setting that is contributing that I haven't been able to isolate as yet.
I can try and move this info into an issue if that would assist.@dgtized That’s a good enough starting point for an investigation. Yeah, please move this info into an issue and I’ll take a look when I can.
Thanks, I re-summarized it in: https://github.com/clojure-emacs/cider/issues/3909
@dgtized could you try the workaround in https://github.com/clojure-emacs/cider/issues/3923? Would be good to check whether it’s the same issue
I haven’t seen a broad wave of “latest CIDER disconnects constantly” reports recently, but what you’re describing does line up with a few failure modes that have become more common in modern CLJS setups, especially around shadow-cljs, nREPL lifecycle handling, and Emacs process/environment mismatches
Hmm, well I'm using figwheel, not shadow-cljs, but if shadow that has gotten more fragile it might be the same cause.
It's been a while, but there was (is?) a bug where cider is only aware of the last repl type it was in. So if you have a clj and cljs repl, if you put your cursor in the clj repl and then a cljs source file it thinks it doesn't have a connection
Yea I've encountered something like that before, but this is from a freshly opened emacs, jack in to a cljs project, it connects, brings up the page, and then immediately disconnects that buffer.