{"record":{"id":"3430cba014589eb6","repo":"Mintplex-Labs/anything-llm","slug":"vscode-ripgrep-not-installed","errorCode":null,"errorMessage":"@vscode/ripgrep not installed","messagePattern":"@vscode/ripgrep not installed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/agents/aibitat/plugins/filesystem/search-files.js","lineNumber":270,"sourceCode":"  },\n};\n\n/**\n * Search for files by glob pattern using ripgrep (fast file listing).\n * @returns {{ files: string[], method: string }}\n */\nfunction searchFilesWithRipgrepGlob({\n  searchPath,\n  patterns,\n  excludePatterns = [],\n  maxResults = 100,\n}) {\n  const { spawnSync } = require(\"child_process\");\n  let rgPath;\n  try {\n    ({ rgPath } = require(\"@vscode/ripgrep\"));\n  } catch {\n    throw new Error(\"@vscode/ripgrep not installed\");\n  }\n\n  // Build ripgrep arguments for file listing\n  const args = [\n    \"--files\", // List files instead of searching content\n    \"--no-ignore\", // Search all files, even those in .gitignore\n  ];\n\n  // Add glob patterns (ripgrep uses --glob for filtering --files output)\n  for (const pattern of patterns) args.push(\"--glob\", pattern);\n  for (const exclude of excludePatterns) args.push(\"--glob\", `!${exclude}`);\n\n  // The \"--\" prevents searchPath from being parsed as an option if it starts with \"-\"\n  // (defense against argument injection attacks)\n  args.push(\"--\", searchPath);\n  const result = spawnSync(rgPath, args, {\n    encoding: \"utf-8\",\n    maxBuffer: 10 * 1024 * 1024,","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/aibitat/plugins/filesystem/search-files.js#L252-L288","documentation":"Thrown by searchFilesWithRipgrepGlob() when require(\"@vscode/ripgrep\") throws, meaning the package is not installed or not resolvable from the current module path. The filesystem search feature depends on this package to locate the ripgrep (rg) binary for fast file listing. The error is a synchronous require failure caught by a try/catch.","triggerScenarios":"The @vscode/ripgrep package is absent from node_modules, its postinstall script (which downloads the platform-specific rg binary) failed or was skipped, or a monorepo/hoisting setup moved the package where this module cannot resolve it.","commonSituations":"A fresh or partial npm install that did not run postinstall; CI with --ignore-scripts that skips the binary download; a production deploy that pruned devDependencies incorrectly; a pnpm/yarn hoisting layout the require cannot follow.","solutions":["Run a full npm install (without --ignore-scripts) so @vscode/ripgrep's postinstall downloads the binary.","Verify the package is present: check node_modules/@vscode/ripgrep and that rg binary exists under its bin.","If scripts are blocked by policy, pre-install the rg binary and make it resolvable, or allow the postinstall.","Reinstall the package specifically: npm install @vscode/ripgrep."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// detect the dependency before relying on ripgrep-based search\nfunction hasRipgrep() {\n  try { require(\"@vscode/ripgrep\"); return true; } catch { return false; }\n}\nif (!hasRipgrep()) throw new Error(\"@vscode/ripgrep missing; run npm install\");","typeGuard":null,"tryCatchPattern":"try {\n  results = searchFilesWithRipgrepGlob({ searchPath, patterns });\n} catch (e) {\n  if (e.message === \"@vscode/ripgrep not installed\") {\n    // fall back to a recursive readdir-based search or install the package\n  } else throw e;\n}","preventionTips":["Run a full npm install without --ignore-scripts so the ripgrep postinstall runs.","Verify node_modules/@vscode/ripgrep and its rg binary exist after install.","In CI/production, do not prune @vscode/ripgrep or skip its postinstall."],"tags":["filesystem","search","dependency","ripgrep","environment"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}