{"record":{"id":"036a1660ef1ed160","repo":"earendil-works/pi","slug":"invalid-npmcommand-first-array-entry-must-be-a-no","errorCode":null,"errorMessage":"Invalid npmCommand: first array entry must be a non-empty command","messagePattern":"Invalid npmCommand: first array entry must be a non-empty command","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/core/package-manager.ts","lineNumber":1754,"sourceCode":"\t\tconst name = match[1] ?? spec;\n\t\tconst version = match[2];\n\t\treturn { name, version };\n\t}\n\n\tprivate assertProjectTrustedForScope(scope: SourceScope): void {\n\t\tif (scope === \"project\" && !this.settingsManager.isProjectTrusted()) {\n\t\t\tthrow new Error(\"Project is not trusted; refusing to access project package storage\");\n\t\t}\n\t}\n\n\tprivate getNpmCommand(): { command: string; args: string[] } {\n\t\tconst configuredCommand = this.settingsManager.getNpmCommand();\n\t\tif (!configuredCommand || configuredCommand.length === 0) {\n\t\t\treturn { command: \"npm\", args: [] };\n\t\t}\n\t\tconst [command, ...args] = configuredCommand;\n\t\tif (!command) {\n\t\t\tthrow new Error(\"Invalid npmCommand: first array entry must be a non-empty command\");\n\t\t}\n\t\treturn { command, args };\n\t}\n\n\tprivate getPackageManagerName(): string {\n\t\tconst npmCommand = this.getNpmCommand();\n\t\tconst commandParts = [npmCommand.command, ...npmCommand.args];\n\t\tconst separatorIndex = commandParts.lastIndexOf(\"--\");\n\t\tconst packageManagerCommand = separatorIndex >= 0 ? commandParts[separatorIndex + 1] : npmCommand.command;\n\t\treturn packageManagerCommand ? basename(packageManagerCommand).replace(/\\.(cmd|exe)$/i, \"\") : \"\";\n\t}\n\n\tprivate async runNpmCommand(args: string[], options?: { cwd?: string }): Promise<void> {\n\t\tconst npmCommand = this.getNpmCommand();\n\t\tawait this.runCommand(npmCommand.command, [...npmCommand.args, ...args], options);\n\t}\n\n\tprivate getGitDependencyInstallArgs(): string[] {","sourceCodeStart":1736,"sourceCodeEnd":1772,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/coding-agent/src/core/package-manager.ts#L1736-L1772","documentation":"Error \"Invalid npmCommand: first array entry must be a non-empty command\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/coding-agent/src/core/package-manager.ts:1754 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}