eyaltoledano/claude-task-master · error · APICallError
Grok CLI is not installed or not found in PATH. Please insta
Error message
Grok CLI is not installed or not found in PATH. Please install with: npm install -g @vibe-kit/grok-cli
What it means
Before invoking the Grok CLI, the language model's doGenerate runs checkGrokCliInstallation() to verify the @vibe-kit/grok-cli binary exists on PATH. If it is not found, it throws an installation error with instructions to install it globally via npm. The provider shells out to the CLI, so the binary is a hard runtime requirement.
Source
Thrown at packages/ai-sdk-provider-grok-cli/src/grok-cli-language-model.ts:262
});
}
return warnings;
}
/**
* Generate text using Grok CLI
*/
async doGenerate(options: LanguageModelV2CallOptions) {
// Handle abort signal early
if (options.abortSignal?.aborted) {
throw options.abortSignal.reason || new Error('Request aborted');
}
// Check CLI installation
const isInstalled = await this.checkGrokCliInstallation();
if (!isInstalled) {
throw createInstallationError({});
}
// Get API key
const apiKey = await this.getApiKey();
if (!apiKey) {
throw createAuthenticationError({
message:
'Grok CLI API key not found. Set GROK_CLI_API_KEY environment variable or configure grok-cli.'
});
}
const prompt = createPromptFromMessages(options.prompt);
const warnings = this.generateAllWarnings(options, prompt);
// Build command arguments
const args = ['--prompt', escapeShellArg(prompt)];
// Add model if specifiedView on GitHub (pinned to c0c98d367c)
Solutions
- Install the CLI globally: npm install -g @vibe-kit/grok-cli
- Verify it resolves: `which grok` (or `where grok` on Windows) and `grok --version`.
- If using nvm/volta, reinstall the global package under the active Node version or add its bin directory to PATH.
- In CI, add an install step for @vibe-kit/grok-cli before running code that uses this provider.
Example fix
// before (shell) node script-using-grok-provider.js // fails: CLI missing // after (shell) npm install -g @vibe-kit/grok-cli && node script-using-grok-provider.js
Defensive patterns
Strategy: validation
Validate before calling
import { execFile } from 'child_process';
import { promisify } from 'util';
const run = promisify(execFile);
export async function assertGrokCliInstalled() {
try { await run('grok', ['--version']); }
catch { throw new Error('Install it first: npm install -g @vibe-kit/grok-cli'); }
} Try / catch
try {
const result = await model.doGenerate({ prompt });
} catch (e) {
if (/not installed or not found in PATH/.test(e.message)) {
throw new Error('Pre-requisite missing: run `npm install -g @vibe-kit/grok-cli`');
}
throw e;
} Prevention
- Add @vibe-kit/grok-cli to setup/bootstrap scripts and CI install steps.
- Check `which grok` at application startup and fail fast with a clear message.
- When using nvm/volta, install global packages per-project hooks so Node switches don't lose them.
- Document the CLI dependency wherever the provider is used.
When it happens
Trigger: Any doGenerate call when the grok-cli executable is absent from PATH — package never installed, installed locally in a different project, or PATH not including the npm global bin directory.
Common situations: Fresh machine or CI container without the global package; using nvm/volta and switching Node versions loses global installs; installing with a different package manager (pnpm/yarn global) whose bin dir is not on PATH.
Related errors
- Project path must be an absolute path
- Git is not installed or not accessible: ${errorMessage}
- INVALID_INPUT
- Grok CLI API key not found. Set GROK_CLI_API_KEY environment
- Grok CLI authentication failed: ${result.stderr}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/270a8bece42c20ab.
Report an issue: GitHub.