{"record":{"id":"3d341275b5b242d0","repo":"tinyhumansai/openhuman","slug":"claude-code-claude-cli-at-unusable","errorCode":null,"errorMessage":"[claude-code] `claude` CLI at {} unusable: {}","messagePattern":"\\[claude-code\\] `claude` CLI at (.+?) unusable: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/inference/provider/claude_code/mod.rs","lineNumber":152,"sourceCode":"            types::CliStatus::NotInstalled => {\n                anyhow::bail!(\n                    \"[claude-code] `claude` CLI not installed. Install Claude Code CLI \\\n                     ({}) >= {} and retry.\",\n                    \"https://docs.anthropic.com/en/docs/claude-code\",\n                    types::MIN_CLI_VERSION\n                )\n            }\n            types::CliStatus::Outdated {\n                version,\n                min_required,\n                path,\n            } => anyhow::bail!(\n                \"[claude-code] `claude` CLI at {} is version {}; require >= {}\",\n                path,\n                version,\n                min_required\n            ),\n            types::CliStatus::Unusable { path, reason } => anyhow::bail!(\n                \"[claude-code] `claude` CLI at {} unusable: {}\",\n                path,\n                reason\n            ),\n        }\n    }\n\n    async fn run_chat(\n        &self,\n        request: ChatRequest<'_>,\n        model_override: Option<&str>,\n    ) -> anyhow::Result<ChatResponse> {\n        // Cap concurrent CC processes.\n        let _permit = self\n            .semaphore\n            .clone()\n            .acquire_owned()\n            .await","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/inference/provider/claude_code/mod.rs#L134-L170","documentation":"`version_check::probe()` located a `claude` binary but could not use it — the `CliStatus::Unusable` arm. The probe's `reason` (appended to the message) covers failures like the binary not being executable, spawning it failed, or its `--version` output being unparseable. Distinct from NotInstalled (nothing found) and Outdated (usable but too old).","triggerScenarios":"A `claude` file exists on PATH but: lacks the executable bit, is a broken symlink/shim (half-failed npm install), is a shell script whose interpreter is missing, or prints version output the parser cannot read (locale-mangled, wrapper banners prepended).","commonSituations":"Interrupted npm installs leaving a dead shim; wrapper scripts (nvm/asdf shims) whose backing runtime was removed; permissions broken after a backup/copy; custom wrapper scripts prepending text to CLI output.","solutions":["Read the `reason` in the message — it names the exact probe failure.","Run `<path> --version` manually in a shell; if it errors or prints anything besides a version, fix or reinstall at that path.","Reinstall the CLI cleanly (`npm uninstall -g @anthropic-ai/claude-code && npm install -g @anthropic-ai/claude-code`) to replace broken shims.","If a wrapper (nvm/asdf) is the culprit, point PATH directly at a real Node bin dir containing a working `claude`."],"exampleFix":"# diagnose at the exact path from the message\n/path/to/claude --version || echo \"binary broken -> reinstall\"\nnpm uninstall -g @anthropic-ai/claude-code && npm install -g @anthropic-ai/claude-code","handlingStrategy":"validation","validationCode":"if let types::CliStatus::Unusable { path, reason } = version_check::probe() {\n    log::warn!(\"claude CLI unusable at {path}: {reason}\");\n    return use_fallback_provider();\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid wrapper shims in PATH for `claude`; point PATH at the real bin directory.","After any npm/global install failure, uninstall fully before reinstalling to clear dead shims.","Include a `claude --version` check in machine bootstrap scripts."],"tags":["claude-code","cli-unusable","installation","permissions"],"backgroundTag":"cli-binary-not-found","analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}