You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cursive's nREPL middleware hides eval errors from other clients connected to the same server #3112
When Cursive connects to an nREPL server, it adds cursive.repl.runtime.middleware/wrap-errors to the server's middleware stack (via add-middleware). From then on, eval errors are hidden from every client on that server, not just Cursive. No other client receives the error text (:err).
Environment
Cursive 2026.2-262, IntelliJ IDEA 2026.2.0.1, macOS 27.0 (26A5425a)
nREPL 1.3.1 (server started with nrepl.server/start-server, default handler), Clojure 1.11.1, Java 21.0.12
To reproduce
Start an nREPL 1.3.1 server and connect Cursive to it as a remote REPL.
From a different nREPL client on the same server (here clj-nrepl-eval from clojure-mcp-light), eval (/ 1 0).
Expected (what happens before Cursive connects, or after its middleware is removed): an :err message with Execution error (ArithmeticException) at …, then :ex/:root-ex with status eval-error.
Actual: no :err message. The response carries :ex, :root-ex, status eval-error, and a non-standard :exception key (a printed map of the error). Clients that show the :err text show nothing, so a failing eval looks like an eval that returned nothing.
Cause.wrap-errors runs inside nrepl.middleware.caught/wrap-caught. Its transport removes :nrepl.middleware.caught/throwable from the eval response and adds :exception, so when the response reaches wrap-caught's transport there is no throwable left, and wrap-caught never calls the caught function that writes the error to *err*. Because the middleware is installed for the whole server, this applies to responses for every session, not only Cursive's.
Suggested fix: add :exception without removing ::caught/throwable, so wrap-caught still prints the error for other clients. Cursive can ignore the resulting :err on its side.
Workaround: remove the middleware with nREPL's swap-middleware op (the stack from ls-middleware, minus wrap-errors). Cursive adds it back the next time it connects.
Activity