{"record":{"id":"270a8bece42c20ab","repo":"eyaltoledano/claude-task-master","slug":"grok-cli-is-not-installed-or-not-found-in-path-pl","errorCode":null,"errorMessage":"Grok CLI is not installed or not found in PATH. Please install with: npm install -g @vibe-kit/grok-cli","messagePattern":"Grok CLI is not installed or not found in PATH\\. Please install with: npm install -g @vibe-kit/grok-cli","errorType":"exception","errorClass":"APICallError","httpStatus":null,"severity":"error","filePath":"packages/ai-sdk-provider-grok-cli/src/grok-cli-language-model.ts","lineNumber":262,"sourceCode":"\t\t\t});\n\t\t}\n\n\t\treturn warnings;\n\t}\n\n\t/**\n\t * Generate text using Grok CLI\n\t */\n\tasync doGenerate(options: LanguageModelV2CallOptions) {\n\t\t// Handle abort signal early\n\t\tif (options.abortSignal?.aborted) {\n\t\t\tthrow options.abortSignal.reason || new Error('Request aborted');\n\t\t}\n\n\t\t// Check CLI installation\n\t\tconst isInstalled = await this.checkGrokCliInstallation();\n\t\tif (!isInstalled) {\n\t\t\tthrow createInstallationError({});\n\t\t}\n\n\t\t// Get API key\n\t\tconst apiKey = await this.getApiKey();\n\t\tif (!apiKey) {\n\t\t\tthrow createAuthenticationError({\n\t\t\t\tmessage:\n\t\t\t\t\t'Grok CLI API key not found. Set GROK_CLI_API_KEY environment variable or configure grok-cli.'\n\t\t\t});\n\t\t}\n\n\t\tconst prompt = createPromptFromMessages(options.prompt);\n\t\tconst warnings = this.generateAllWarnings(options, prompt);\n\n\t\t// Build command arguments\n\t\tconst args = ['--prompt', escapeShellArg(prompt)];\n\n\t\t// Add model if specified","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/ai-sdk-provider-grok-cli/src/grok-cli-language-model.ts#L244-L280","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (shell)\nnode script-using-grok-provider.js   // fails: CLI missing\n// after (shell)\nnpm install -g @vibe-kit/grok-cli && node script-using-grok-provider.js","handlingStrategy":"validation","validationCode":"import { execFile } from 'child_process';\nimport { promisify } from 'util';\nconst run = promisify(execFile);\nexport async function assertGrokCliInstalled() {\n  try { await run('grok', ['--version']); }\n  catch { throw new Error('Install it first: npm install -g @vibe-kit/grok-cli'); }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const result = await model.doGenerate({ prompt });\n} catch (e) {\n  if (/not installed or not found in PATH/.test(e.message)) {\n    throw new Error('Pre-requisite missing: run `npm install -g @vibe-kit/grok-cli`');\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["grok-cli","installation","path","cli-dependency"],"backgroundTag":"cli-not-installed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}