earendil-works/pi · error · Error
Invalid npmCommand: first array entry must be a non-empty co
Error message
Invalid npmCommand: first array entry must be a non-empty command
What it means
Error "Invalid npmCommand: first array entry must be a non-empty command" thrown in earendil-works/pi.
Source
Thrown at packages/coding-agent/src/core/package-manager.ts:1754
const name = match[1] ?? spec;
const version = match[2];
return { name, version };
}
private assertProjectTrustedForScope(scope: SourceScope): void {
if (scope === "project" && !this.settingsManager.isProjectTrusted()) {
throw new Error("Project is not trusted; refusing to access project package storage");
}
}
private getNpmCommand(): { command: string; args: string[] } {
const configuredCommand = this.settingsManager.getNpmCommand();
if (!configuredCommand || configuredCommand.length === 0) {
return { command: "npm", args: [] };
}
const [command, ...args] = configuredCommand;
if (!command) {
throw new Error("Invalid npmCommand: first array entry must be a non-empty command");
}
return { command, args };
}
private getPackageManagerName(): string {
const npmCommand = this.getNpmCommand();
const commandParts = [npmCommand.command, ...npmCommand.args];
const separatorIndex = commandParts.lastIndexOf("--");
const packageManagerCommand = separatorIndex >= 0 ? commandParts[separatorIndex + 1] : npmCommand.command;
return packageManagerCommand ? basename(packageManagerCommand).replace(/\.(cmd|exe)$/i, "") : "";
}
private async runNpmCommand(args: string[], options?: { cwd?: string }): Promise<void> {
const npmCommand = this.getNpmCommand();
await this.runCommand(npmCommand.command, [...npmCommand.args, ...args], options);
}
private getGitDependencyInstallArgs(): string[] {View on GitHub (pinned to 4af9d21d3b)
When it happens
Trigger: Thrown at packages/coding-agent/src/core/package-manager.ts:1754 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/036a1660ef1ed160.
Report an issue: GitHub.