abhigyanpatwari/GitNexus · error · Error
Claude CLI not found. Install Claude Code and ensure `claude
Error message
Claude CLI not found. Install Claude Code and ensure `claude` is on PATH.
What it means
The wiki `--provider claude` path shells out to the user's local Claude Code CLI. Before running, detectLocalCLI executes `claude --version`; if that fails (binary not on PATH → ENOENT, or non-zero exit), the provider is cached as unavailable and callClaudeLLM throws this immediately. Note it can also fire when the binary exists but --version exits non-zero (e.g. broken install), with a warning logged.
Source
Thrown at gitnexus/src/core/wiki/local-cli-client.ts:103
}
export function resolveLocalCLIConfig(overrides?: Partial<LocalCLIConfig>): LocalCLIConfig {
return {
model: overrides?.model,
workingDirectory: overrides?.workingDirectory,
requestTimeoutMs: overrides?.requestTimeoutMs,
};
}
export async function callClaudeLLM(
prompt: string,
config: LocalCLIConfig,
systemPrompt?: string,
options?: CallLLMOptions,
): Promise<LLMResponse> {
const commandInfo = getDetectedCommand('claude');
if (!commandInfo) {
throw new Error('Claude CLI not found. Install Claude Code and ensure `claude` is on PATH.');
}
const args = ['-p', '--output-format', 'text', '--no-session-persistence'];
if (config.model) {
args.push('--model', config.model);
}
const fullPrompt = systemPrompt ? `${systemPrompt}\n\n---\n\n${prompt}` : prompt;
const response = await runLocalCLI('claude', commandInfo, args, config, fullPrompt, options);
if (!response.content) {
throw new Error('claude CLI returned empty output');
}
return response;
}
export async function callCodexLLM(
prompt: string,
config: LocalCLIConfig,View on GitHub (pinned to aac7515d2a)
Solutions
- Install Claude Code and verify `claude --version` works in the same shell/environment you run gitnexus from
- Fix PATH: ensure the claude binary directory (e.g. ~/.local/bin or npm global bin) is exported in the environment
- Once installed, authenticate (`claude` login) so the CLI can answer prompts
- If you don't want the local CLI, switch to an HTTP provider: `--provider openai|azure|minimax --api-key ...`
Example fix
# before gitnexus wiki --provider claude # claude: not found # after npm install -g @anthropic-ai/claude-code claude --version gitnexus wiki --provider claude
Defensive patterns
Strategy: validation
Validate before calling
import { execFileSync } from 'child_process';
function claudeCliAvailable(): boolean {
try { execFileSync('claude', ['--version'], { stdio: 'ignore' }); return true; }
catch { return false; }
}
if (!claudeCliAvailable()) throw new Error('Install Claude Code first'); Type guard
function claudeCliAvailable(): boolean {
try { execFileSync('claude', ['--version'], { stdio: 'ignore' }); return true; }
catch { return false; }
} Try / catch
try {
await callClaudeLLM(prompt, config);
} catch (err) {
if (err instanceof Error && err.message.includes('Claude CLI not found')) {
// fall back to an HTTP provider instead of the local CLI
return callLLM(prompt, httpConfig);
}
throw err;
} Prevention
- Pre-flight local CLI providers with `<cmd> --version` in setup scripts
- In CI, install the CLI and import auth state as an explicit pipeline step
- Provide an HTTP-provider fallback path when the local CLI is absent
When it happens
Trigger: Running `gitnexus wiki --provider claude` without Claude Code installed; `claude` not on PATH in the current shell/CI container; claude installed via a version manager whose shims aren't in PATH for this process; broken install where `claude --version` errors.
Common situations: CI runners assuming the CLI is preinstalled; nvm/asdf PATH not loaded in non-interactive shells; Windows installs without PATH entry; running in a container where only the Node API key flow was set up.
Related errors
- Codex CLI not found. Install Codex CLI and ensure `codex` is
- claude CLI returned empty output
- --allow-insecure-connection / GITNEXUS_ALLOW_INSECURE_CONNEC
- Invalid LLM base URL: must be a well-formed http:// or https
- LLM base URL must use http:// or https:// (got ${parsed.prot
AI-assisted analysis of abhigyanpatwari/GitNexus@aac7515d2a (2026-08-20).
Data as JSON: /api/errors/9bdc0f8546bfc83a.
Report an issue: GitHub.