Mintplex-Labs/anything-llm · error
@vscode/ripgrep not installed
Error message
@vscode/ripgrep not installed
What it means
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.
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).
Example fix
# before
agent invokes search_files -> Error: @vscode/ripgrep not installed
# after
cd server && npm install @vscode/ripgrep
node -e "console.log(require('@vscode/ripgrep').rgPath)" # sanity check
docker restart anythingllm Defensive patterns
Strategy: validation
Validate before calling
function ripgrepAvailable() {
try {
const { rgPath } = require("@vscode/ripgrep");
return typeof rgPath === "string" && require("fs").existsSync(rgPath);
} catch {
return false;
}
}
if (!ripgrepAvailable()) {
throw new Error("File listing unavailable: install @vscode/ripgrep (cd server && npm i @vscode/ripgrep)");
} Try / catch
try {
const { files } = searchFilesWithRipgrepGlob({ searchPath, patterns });
} catch (e) {
if (e.message === "@vscode/ripgrep not installed") {
// degrade gracefully: fall back to list_directory + manual filtering, and surface an install hint
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- ripgrep exited with code
- search pattern must not start with '-'
- Access denied - parent directory outside allowed…
- Access denied - path outside allowed directories.
- Access denied - symlink target outside allowed directories.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/3430cba014589eb6.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/agents/aibitat/plugins/filesystem/search-files.js:270
},
};
/**
* Search for files by glob pattern using ripgrep (fast file listing).
* @returns {{ files: string[], method: string }}
*/
function searchFilesWithRipgrepGlob({
searchPath,
patterns,
excludePatterns = [],
maxResults = 100,
}) {
const { spawnSync } = require("child_process");
let rgPath;
try {
({ rgPath } = require("@vscode/ripgrep"));
} catch {
throw new Error("@vscode/ripgrep not installed");
}
// Build ripgrep arguments for file listing
const args = [
"--files", // List files instead of searching content
"--no-ignore", // Search all files, even those in .gitignore
];
// Add glob patterns (ripgrep uses --glob for filtering --files output)
for (const pattern of patterns) args.push("--glob", pattern);
for (const exclude of excludePatterns) args.push("--glob", `!${exclude}`);
// The "--" prevents searchPath from being parsed as an option if it starts with "-"
// (defense against argument injection attacks)
args.push("--", searchPath);
const result = spawnSync(rgPath, args, {
encoding: "utf-8",
maxBuffer: 10 * 1024 * 1024,View on GitHub (pinned to 3aec848f28)