👋 Thanks for making Calva, awesome project!
One feature that I use often is clojure-lsp Refactor: Extract to New Function
It seems to have stopped working for me, and I’m not sure how to debug it…
When I execute the command, I get an alert toast with this message:
Request workspace/executeCommand failed.
When I follow the Go to output prompt in the alert toast, I see this in the OUTPUT panel
[Error - 6:39:01 PM] Request workspace/executeCommand failed.
Message: Internal error
Code: -32603
[object Object]
I’m using Calva version 2.0.573
More info from Calva Says tab in the OUTPUT panel:
Calva version used: v2.0.573
clojure-lsp version used: 2026.02.20-16.08.58
clj-kondo version used: 2026.01.19
clojure-lsp version used: 2026.02.20-16.08.58
clj-kondo version used: 2026.01.19
VSCode info:
Version: 1.115.0 (Universal)
Commit: 41dd792b5e652393e7787322889ed5fdc58bd75b
Date: 2026-04-07T22:04:57Z
Electron: 39.8.5
ElectronBuildId: 13703022
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Darwin x64 24.5.0
Any help with this is appreciated!Oops, I just saw this now. I'll add it to my list to visit soon
FWIW, the failure I'm seeing with clean ns form seems intermittent.
at least for lsp-mode was easy as call the command, https://github.com/emacs-lsp/lsp-mode/issues/5023
I'll try lsp-mode. I've been trying Calva 2.0.573 and I can't get it to reproduce. Maybe it's something about my environment (Fedora). In any case, given the stack I can make a guess
I believe there was a fix in calva related to that as well?
Yeah, but the OP report was on 2.0.573. Prior to that I had tried commenting out the fix in the Calva commit (5ff1bd7) and rebuilding the VSIX but I couldn't reproduce there
I have an old version of lsp-mode and a dev version of clojure-lsp. Am I doing something dumb to not reproduce this?
Here's Extract Function with Calva and (versions from OP) Calva version used: v2.0.573 clojure-lsp version used: 2026.02.20-16.08.58 There must be something I'm doing different, but I don't see it
Hm... actually, I could check if I'm getting more than three arguments logged, and even reproduce it that way if I can't do it manually
Sure enough, I'm always getting 6 arguments for some reason.
"command": "extract-function",
"arguments": [
"file:///path/to/state.clj",
671,
3,
"new-function",
671,
3
When not selecting something, the last two args (row,col) are the same as first twoHave you tried with Command Palette? I was able to reproduce like that
That is it! Thank you!!!
Easy fix, I'll open it on clojure-lsp. Duh! When I created this bug I had convinced myself that my little shortcut was OK because clojure-lsp is returning a 6 arg version as a code action. I didn't realize clients could construct their own code actions
Filed: https://github.com/clojure-lsp/clojure-lsp/issues/2276
I think that latest Calva is no longer tripping on this one. @jonurnieta ?
The issue with “Extract to new function” was fixed, but I didn’t make any changes to this one. I use it regularly and haven’t been able to reproduce it yet. If I can see the console error, I might be able to investigate further. 🙏🏿
Ah! Thanks. There are too many features in Calva! 😃
I see, I'm off the hook for "Extract to new function", it was fixed by @jonurnieta in Calva via https://github.com/clojure-lsp/clojure-lsp/issues/2118 and https://github.com/BetterThanTomorrow/calva/pull/3174. Yeah, this looks like it is due to something I added to support selection in function extraction in clojure-lsp. This reminds me that I have some changes to add a few new clojure-lsp refactorings to Calva that I should submit.
@john.t.richardson.dev I had to fix lsp-mode as well and we might need to do the same for nvim and clojure-lsp-intellij, or we do a fix in Clojure-lsp if possible
I wonder how I didn't see this? Is there a reproducer that I'm missing?
ok thanks!
I also recently noticed something which seems like a regression. When I hit tab to reformat a map with Calva Format: Format and Align Current Form, it inserts a newline after the opening bracket. If I install a Calva version from a couple months ago, the problem goes away.
Maybe there is a setting I could tweak to fix this?
I think it's a cljfmt bug that has just been fixed https://github.com/weavejester/cljfmt/pull/409
when calva updates cljfmt to https://github.com/weavejester/cljfmt it may be fixed
Please file it as an issue, so that it people can find it and we can comment there about the possible coming fix.
I get the same OP error trying to run clojure-lsp Refactor: Clean NS Form.
My versions:
Calva version used: v2.0.573
clojure-lsp version used: 2026.03.30-12.34.10-nightly
clj-kondo version used: 2026.01.20-SNAPSHOT
I just updated clojure-lsp and the issue persists:
clojure-lsp version used: 2026.04.15-12.53.12-nightly
clj-kondo version used: 2026.04.15
Should an issue be opened for that too? Or maybe I'll just forward this thread to #lsp to see what Eric wants to do...
Yes, issue for that one too would be good.
Is it a Calva issue or an LSP issue tho'?
does this happens only in nightly or stable clojure-lsp?
Several versions are mentioned in this thread -- OP was using a stable version from February, I was using two different nightly versions.
refactors are working in my latest clojure-lsp nightly in my emacs, so it could be a calva issue
let me try calva
Yeah I can repro with calva, let me check deeper
clojure-lsp is throwing a exception
com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine PlatformThreads.java: 872
com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine PlatformThreads.java: 896
java.lang.Thread.run Thread.java:1583
java.lang.Thread.runWith Thread.java:1596
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 642
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java:1144
java.util.concurrent.CompletableFuture$AsyncSupply.run CompletableFuture.java:1768
promesa.util.Supplier/get util.cljc: 34
promesa.exec/wrap-bindings/fn exec.cljc: 200
clojure-lsp.server/fn{x2} server.clj: 449
clojure-lsp.handlers/execute-command handlers.clj: 375
clojure-lsp.feature.command/call-command command.clj: 228
...
java.lang.IndexOutOfBoundsException:I believe it's related with https://github.com/clojure-lsp/clojure-lsp/issues/2118 c/c @john.t.richardson.dev
It feels like this only starting to break recently? I haven't tried going back through Calva versions to see if there's an older version that still works...
I don’t think something has changed in Calva around this since September last year.
yeah me too, my guess this is broken for some time for this command especifically, other commands work
Refactors can be dome via the refactor command and as separate commands. Maybe one works and the other doesn’t, and that limits the blast radius…
I reproduce the extract to new function error but not clojure-lsp Refactor: Clean NS Form
I've seen this error occasionally but haven't tracked it down to a single command or file. I'm using nightly:
Calva version used: v2.0.573
clojure-lsp version used: 2026.03.30-12.34.10-nightly
clj-kondo version used: 2026.01.20-SNAPSHOTFrom the error it looks like it goes boom in clojure-lsp. So it could be worth bisecting it with some previous versions of the lsp server.