Skip to content

Installer check: a hanging command counts as installed #1957

Closed

Description

@muescha

A follow-up of #1954, found while going through all templates; collected in #1943.

Summary

20 of the 36 installers (17 language servers, 3 debug adapters) check whether their server is installed by starting it: "command": "${server.command}", with "timeout": 2000. ExecTask.run counts that as success when the process exits with 0 and wrote nothing to stderr, and also when it's still running at the timeout:

if (result.isTimeout()) {
    return true;
}
return result.getExitCode() == 0 && (ignoreStderr || result.getStderr().isEmpty());

That's meant for a server that starts and then waits for messages. But anything that doesn't exit within 2 s passes too, and Install if Needed only installs when the check fails (ServerInstallerBase). So a command that hangs hides a missing or broken server:

A server that exits right away, e.g. because its arguments are wrong, is caught, which is how a broken sh -c command gets fixed by its installer today. (The Check / Run Installation link on the Installer tab runs both steps anyway, so it isn't affected.)

The installers checking with ${server.command} and a 2 s timeout: astro-ls, candor-lsp, dart-lsp, eo-lsp-server, gopls, jq-lsp, metals, ruby-lsp, sdl-lsp, sourcekit-lsp, stylelint-lsp, svelte-language-server, sysml-lsp, typescript-language-server, vscode-css-language-server, vscode-eslint-language-server, vue-js-language-server, and the debug adapters go-delve, python-debugpy and ruby-rdbg.

Ideas for a reliable check

  1. Check with initialize, the most reliable. For ${server.command}, start the server the way LSP4IJ does anyway (createConnectionProvider and the LSP4J launcher), send an initialize request, and count only a response as success; then shutdown and exit. For example:

    "check": {
      "initialize": {
        "name": "Trying the language server",
        "timeout": 10000
      }
    }
  2. A version command. Already possible today, e.g. "command": "typescript-language-server --version", and it exits on its own, so no timeout is needed. Many servers have one (typescript-language-server --version, rust-analyzer --version, clangd --version, jq-lsp --version, gopls version), but not all, and the option differs per server. It also checks the program, not the configured command: with sh -c typescript-language-server --stdio, --version would have to go to typescript-language-server, not to sh. A variable such as ${server.executable} (the program of the configured command) could help, as in ${server.executable} --version.

  3. Make the timeout explicit. Count a timeout as a failure unless the step says otherwise, e.g. "timeoutIsSuccess": true. That's the smallest change, keeps today's behaviour where it's wanted, and makes it visible in the template; but it doesn't make the check more reliable.

  4. Only check that the program exists, as some installers do with which go or where go before installing. Cheap, but it only says that the program is on the PATH, not that it starts.

Suggestion: 1 for ${server.command}, 2 for installers that want a quick check, and 3 in any case, so that a timeout is never a success by accident.

How this was checked

Claude Code found this by reading ExecTask, ServerInstallerBase and all installer.json files at 42b4e25; the Ruby LSP case comes from running sh -s ruby-lsp by hand on macOS, not from the installer in the IDE. The other examples are kinds of failure, not cases that were seen.

Activity

  1. lagergren commented on Nov 13, 2026

    @lagergren
    Collaborator

    The Ruby LSP case is fixed in 0.30.0, by #1976: the template starts ruby-lsp itself, without sh -s, so the check with ${server.command} fails when Ruby LSP isn't installed, and the installer installs it. The rest stands: a command that waits for input, hangs, or crashes after the 2 seconds still counts as installed.

  2. lagergren commented on Nov 20, 2026

    @lagergren
    Collaborator

    Where this stands, and a proposal for the rest, which needs @angelozerr's OK since it adds a task to the installer.json format.

    ExecTask counts a command that still runs at its timeout as a success, and that is what 20 installers rely on: 22 checks, in 17 language servers and 3 debug adapters, run ${server.command} with a timeout of 2 seconds, and a server that starts waits for messages on its standard input until the timeout ends it. So a timeout can't just count as not installed: those checks would fail for servers that work, and Install if Needed would install them again each time. But a server that hangs, waits for input, or fails after 2 seconds counts as installed too.

    Proposal, the first idea of the issue: a check task that starts the language server with its command, as LSP4IJ starts it, sends initialize (the DAP initialize for a debug adapter), and counts only a reply within its timeout as installed. It then ends the server with shutdown and exit (disconnect for a debug adapter). The 20 installers would use it instead of exec with ${server.command}:

    "check": {
      "initialize": {
        "name": "Check that ruby-lsp starts",
        "timeout": 10000
      }
    }

    The other checks, fileExists and exec with a command that ends, as node --version, stay as they are. Would that be OK?

  3. added
    bug
    on Nov 21, 2026
  4. added this to the 0.30.2 milestone on Nov 22, 2026
  5. added a commit that references this issue on Nov 23, 2026
    1786882
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buginstall

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions