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 specified

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Install the CLI globally: npm install -g @vibe-kit/grok-cli
  2. Verify it resolves: `which grok` (or `where grok` on Windows) and `grok --version`.
  3. If using nvm/volta, reinstall the global package under the active Node version or add its bin directory to PATH.
  4. 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

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


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/270a8bece42c20ab. Report an issue: GitHub.