Skip to content

A command without any parts throws a NullPointerException when a working directory is set #1895

Closed

Description

@muescha

Since #1693, CommandUtils.createCommandLine looks up the executable when a working directory is set. A command that has no parts after parsing, such as "", then throws a NullPointerException instead of the platform's "executable not specified" error.

How it happens

"" isn't blank, so the validation of a user-defined language server and the blank check in DebugAdapterDescriptor.createStartServerCommandLine let it through. CommandUtils.createCommands("\"\"") returns no parts, so new GeneralCommandLine(List.of()) leaves the executable null, although getExePath() is annotated @NotNull. resolveExecutable then calls indexOf on it:

String executable = commandLine.getExePath();          // null for a command without parts
if (executable.indexOf(File.separatorChar) != -1) {    // NullPointerException

static void resolveExecutable(@NotNull GeneralCommandLine commandLine) {
String executable = commandLine.getExePath();
if (executable.indexOf(File.separatorChar) != -1) {
// A path to the executable, which the platform doesn't look up either
return;

Before #1693, the command line was created without a problem, and starting it failed with the platform's error. Without a working directory, that's still the case. It hasn't been checked how the NullPointerException shows up for the user, in the start of a language server or in a debug adapter's run configuration.

Possible direction

Return early in resolveExecutable when getExePath() is null or blank, so that the platform reports the missing executable as before.

Claude Code found this by analyzing the code; it hasn't been reproduced by running it.

Activity

  1. added a commit that references this issue on Nov 9, 2026
    801f131
  2. added a commit that references this issue on Nov 10, 2026
    18f9d5e
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions