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
A command without any parts throws a NullPointerException when a working directory is set #1895
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:
Stringexecutable = commandLine.getExePath(); // null for a command without partsif (executable.indexOf(File.separatorChar) != -1) { // NullPointerException
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
fix: leave a command line without an executable to the platform
fix: look up a plugin's server command and an installer's exec comman…