Repository navigation
Description
Problem
When a debug session of the ruby-rdbg template starts, LSP4IJ shows the notification "Installation of Ruby Debug failed", although rdbg is installed and the debug session itself works.
This was found while taking the screenshots for the Ruby page in #2294.
There is no way to see in the IDE why it failed:
- The
Installertab of the debug window shows no output, also after clickingCheck Installation. idea.loghas no entry for the installer or for the commands it ran.
Setup
- macOS.
- Ruby 4.0.9 and debug 1.11.1, installed with mise, set only for the project with a
mise.toml(no global Ruby in mise). - LSP4IJ 0.30.2-SNAPSHOT, in IntelliJ IDEA 2026.3.1 Preview (started from JetBrains Toolbox) and in IntelliJ IDEA 2024.2 (started with
./gradlew runIde). - The
ruby-rdbginstaller runsrdbg --versionas its check andgem install debugto install (installer.json).
Cause
The installer of a debug adapter runs its commands without a project, so not in the project directory:
-
DebugAdapterServerInstallerBase.getProject()always returnsnull. The installer of a language server returns the project of its client (LanguageServerInstallerBase.getProject()). -
DeclarativeDebugAdapterServerInstallercreates theInstallerContextwith thatnullproject. -
Without a project and without a
workingDirininstaller.json,ExecTask.getWorkingDirreturnsnull, and the command runs in the directory of the IDE process:/for an IDE started from the Dock or from Toolbox, or the directory./gradlew runIdewas started in. -
There, the
rdbgshim of mise finds nomise.tomland no global Ruby, so the check fails:$ rdbg --version # in / mise ERROR No version is set for shim: rdbg. Run `mise use -g [email protected]` to set a default, ... -
Then
gem install debugruns, also outside the project. In the shell environment that the IDE loaded at its start,/usr/bincomes before the mise shims inPATH, sogemis the system Ruby 2.6 of macOS (gem env gemdir→/Library/Ruby/Gems/2.6.0). debug needs Ruby 2.7 or later, and that directory isn't writable withoutsudo, so the installation fails.
The same two commands succeed in the project directory, with the same environment:
$ rdbg --version # in the project directory
rdbg 1.11.1
$ gem --version # in the project directory, shims first in PATH
4.0.20
The debug session works anyway, because with the attach configuration LSP4IJ doesn't start rdbg: it was started in a terminal, in the project directory.
Who is affected
Every debug adapter template whose check or installation depends on the project directory, for example with a tool version set per project by mise, asdf, rbenv, pyenv or nvm (mise.toml, .tool-versions, .ruby-version, .python-version, .nvmrc). Language server templates are not affected, because their installer gets the project.
Does this happen to others?
Has anybody else seen "Installation of … failed" for a debug adapter whose tool is installed per project? On Windows, and with other version managers than mise, this is not tested.
Proposal
- Give the installer of a debug adapter the project of the run configuration or debug session, so its commands run in the project directory, like the installer of a language server.
- Independent of that, log what the installer runs, see "Related".
Related
A general proposal to log every installer run (commands, PATH, exit codes and output, in the Installer tab and in idea.log) follows in a separate issue. With such a log, this problem could have been analyzed from the IDE.
Pair-programmed with ❤️ by @muescha and ⚙️ by 🤖 Claude Code
Activity
feat: show the directory, PATH and exit code of each installer comman…