{"record":{"id":"0aa1a695169de4a5","repo":"paperclipai/paperclip","slug":"npm-returned-an-empty-version-response","errorCode":null,"errorMessage":"npm returned an empty version response.","messagePattern":"npm returned an empty version response\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/install.ts","lineNumber":110,"sourceCode":"\nexport function resolveNpmInstallRequest(options: InstallOptions): {\n  spec: string;\n  channel: InstallChannel;\n} {\n  if (options.canary && options.version) throw new Error(\"Choose either --canary or --version, not both.\");\n  if (options.version) {\n    const version = options.version.trim();\n    if (!EXACT_VERSION_PATTERN.test(version)) {\n      throw new Error(`--version requires an exact published version, received '${options.version}'.`);\n    }\n    return { spec: version, channel: \"pinned\" };\n  }\n  return options.canary ? { spec: \"canary\", channel: \"canary\" } : { spec: \"latest\", channel: \"latest\" };\n}\n\nfunction parseResolvedVersion(stdout: string): string {\n  const trimmed = stdout.trim();\n  if (!trimmed) throw new Error(\"npm returned an empty version response.\");\n  try {\n    const parsed = JSON.parse(trimmed) as unknown;\n    if (typeof parsed === \"string\") return parsed;\n  } catch {\n    if (EXACT_VERSION_PATTERN.test(trimmed)) return trimmed;\n  }\n  throw new Error(`npm returned an unexpected version response: ${trimmed}`);\n}\n\nexport async function resolvePublishedVersion(spec: string, runCommand: CommandRunner): Promise<string> {\n  const result = await runCommand(\n    \"npm\",\n    [\"view\", `paperclipai@${spec}`, \"version\", \"--json\", `--registry=${PUBLIC_NPM_REGISTRY}`],\n    { maxBuffer: 1024 * 1024 },\n  );\n  return parseResolvedVersion(result.stdout);\n}\n","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/install.ts#L92-L128","documentation":"Error \"npm returned an empty version response.\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at cli/src/commands/install.ts:110 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":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}