diegosouzapw/OmniRoute · error · Error
Local corpus file exceeds the configured read limit
Error message
Local corpus file exceeds the configured read limit
What it means
The lstat size of the target file exceeds limits.maxFileBytes. The size check runs before any content is read so oversized files are rejected cheaply — the configured read limit for the corpus is smaller than the requested file.
Solutions
- Read a line range (startLine/endLine) instead of the whole file
- Raise maxFileBytes only if memory allows
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/localCorpus/index.ts:559 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/b1d660f505ff78f7.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/localCorpus/index.ts:559
}
const root = await this.getRoot();
const resolved = path.resolve(root, inputPath);
if (!isContained(root, resolved)) {
throw new Error("Local corpus file path escapes the configured root");
}
let linkStat;
try {
linkStat = await fs.lstat(resolved);
} catch {
throw new Error("Local corpus file is not accessible");
}
if (linkStat.isSymbolicLink() || !linkStat.isFile()) {
throw new Error("Local corpus path must point to a regular file");
}
if (linkStat.size > this.limits.maxFileBytes) {
throw new Error("Local corpus file exceeds the configured read limit");
}
let canonicalFile: string;
try {
canonicalFile = await fs.realpath(resolved);
} catch {
throw new Error("Local corpus file is not accessible");
}
if (!isContained(root, canonicalFile)) {
throw new Error("Local corpus file path escapes the configured root");
}
let content: string;
try {
content = await fs.readFile(canonicalFile, "utf8");
} catch {
throw new Error("Local corpus file is not accessible");
}View on GitHub (pinned to a179ffed5b)