{"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":null,"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/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/agents/aibitat/plugins/filesystem/search-files.js#L252-L288","documentation":"Thrown by searchFilesWithRipgrepGlob when require(\"@vscode/ripgrep\") fails, i.e. the package (or its rg binary wrapper) is not resolvable from server/utils/agents/aibitat/plugins/filesystem. The AnythingLLM filesystem search tools shell out to the ripgrep binary that @vscode/ripgrep downloads at install time, so a missing or broken install disables glob-based file listing. Only the require failure is reported — the error says nothing about the rg binary itself.","triggerScenarios":"The agent calls search_files / list_files with glob patterns and @vscode/ripgrep is absent from server/node_modules (optional or pruned dependency); npm install ran with --omit=optional or --production pruning that dropped it; Docker image built without the package or with a failed postinstall download.","commonSituations":"Custom Docker images that slim node_modules; CI caches stripping optional deps; pnpm/yarn strict hoisting so require cannot resolve it from the plugin directory; corporate proxy blocked the postinstall binary download so the package is half-installed.","solutions":["Install it in the server workspace: cd server && npm install @vscode/ripgrep, then restart the process/container.","Verify resolvability: node -e \"console.log(require('@vscode/ripgrep').rgPath)\" from the server directory; it must print a path and that binary must exist and be executable.","Rebuild the Docker image without dependency pruning so the package and its downloaded rg binary survive.","If install is intentionally impossible, stop using the filesystem search tools (fall back to list_directory + read_file)."],"exampleFix":"# before\nagent invokes search_files -> Error: @vscode/ripgrep not installed\n\n# after\ncd server && npm install @vscode/ripgrep\nnode -e \"console.log(require('@vscode/ripgrep').rgPath)\"  # sanity check\ndocker restart anythingllm","handlingStrategy":"validation","validationCode":"function ripgrepAvailable() {\n  try {\n    const { rgPath } = require(\"@vscode/ripgrep\");\n    return typeof rgPath === \"string\" && require(\"fs\").existsSync(rgPath);\n  } catch {\n    return false;\n  }\n}\nif (!ripgrepAvailable()) {\n  throw new Error(\"File listing unavailable: install @vscode/ripgrep (cd server && npm i @vscode/ripgrep)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  const { files } = searchFilesWithRipgrepGlob({ searchPath, patterns });\n} catch (e) {\n  if (e.message === \"@vscode/ripgrep not installed\") {\n    // degrade gracefully: fall back to list_directory + manual filtering, and surface an install hint\n  } else throw e;\n}","preventionTips":["Pin @vscode/ripgrep in server/package.json so npm ci always installs it.","Run its postinstall where network (or a cached binary mirror) is reachable when building Docker images.","Add a startup self-check that require.resolve('@vscode/ripgrep') succeeds and rgPath exists."],"tags":["filesystem","ripgrep","missing-dependency","search","npm"],"backgroundTag":"missing-dependency","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}