{"record":{"id":"5c83ec8c76b2ec9d","repo":"thedotmack/claude-mem","slug":"install-could-not-detect-claude-code-version","errorCode":null,"errorMessage":"[install] Could not detect Claude Code version:","messagePattern":"\\[install\\] Could not detect Claude Code version:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/npx-cli/commands/install.ts","lineNumber":98,"sourceCode":"    ? (lookupWindowsCommand('claude') ?? 'claude.cmd')\n    : 'claude';\n  const invocation = buildSpawnSyncInvocation(command, ['--version'], {\n    timeout: 5000,\n    encoding: 'utf-8',\n  });\n  const result = spawnSync(invocation.command, invocation.args, invocation.options);\n  const output = (result.stdout ?? '').trim();\n  if (!output) return undefined;\n  // \"2.0.14 (Claude Code)\" → \"2.0.14\"\n  return output.split(/\\s+/)[0].slice(0, 40) || undefined;\n}\n\nfunction detectClaudeCodeVersion(): string | undefined {\n  try {\n    return readClaudeCodeVersionOutput();\n  } catch (error: unknown) {\n    const err = error instanceof Error ? error : new Error(String(error));\n    console.warn('[install] Could not detect Claude Code version:', err);\n    return undefined;\n  }\n}\n\ninterface TaskDescriptor {\n  title: string;\n  task: (message: (msg: string) => void) => Promise<string>;\n}\n\nasync function runTasks(tasks: TaskDescriptor[]): Promise<void> {\n  if (isInteractive) {\n    await p.tasks(tasks);\n  } else {\n    for (const t of tasks) {\n      const result = await t.task((msg: string) => console.log(`  ${msg}`));\n      console.log(`  ${result}`);\n    }\n  }","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/commands/install.ts#L80-L116","documentation":"detectClaudeCodeVersion() wraps readClaudeCodeVersionOutput() and logs this warning when the probe throws, returning undefined so the installer continues without a recorded Claude Code version. The install itself is not aborted; only version reporting/diagnostics lose that data point.","triggerScenarios":"readClaudeCodeVersionOutput throws while locating or running the `claude --version` command — Claude Code not on PATH, command fails, or output parsing encounters an unexpected format.","commonSituations":"Claude Code installed via a non-standard method (native binary vs npm) so version probing fails; `claude` not on PATH in the installer's shell; recent Claude Code release changed its --version output format; permission-restricted install location.","solutions":["Verify `claude --version` works manually in the same shell as the installer.","Ensure the Claude Code binary directory is on PATH (the installer's PATH-setup step can help).","Reinstall or update Claude Code (`npm install -g @anthropic-ai/claude-code`).","Proceed with install — undefined version is tolerated; re-run install/doctor afterwards to record it."],"exampleFix":"// before\nconst version = detectClaudeCodeVersion();\n// after (pre-check on PATH)\nconst claudeOnPath = process.env.PATH?.split(':').some(d => existsSync(join(d, 'claude')));\nconst version = claudeOnPath ? detectClaudeCodeVersion() : undefined;","handlingStrategy":"fallback","validationCode":"import { execFileSync } from 'child_process';\nfunction claudeAvailable(): boolean {\n  try { execFileSync('claude', ['--version'], { stdio: 'ignore' }); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  return readClaudeCodeVersionOutput();\n} catch (error: unknown) {\n  console.warn('[install] Could not detect Claude Code version:', error instanceof Error ? error.message : String(error));\n  return undefined; // continue install without version metadata\n}","preventionTips":["Ensure the `claude` binary is on PATH before running the installer.","Keep Claude Code installed via a supported method (npm global) so version probing works.","Validate --version output format after Claude Code upgrades.","Treat undefined version as non-fatal; re-run installer/doctor to re-record it."],"tags":["installer","version-detection","claude-code","cli"],"backgroundTag":"command-not-found","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}