diegosouzapw/OmniRoute · error · Error

Local corpus file is not valid text

Error message

Local corpus file is not valid text

What it means

Error "Local corpus file is not valid text" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/localCorpus/index.ts:578

    }

    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");
    }
    if (content.includes("\0")) throw new Error("Local corpus file is not valid text");

    const lines = content.split(/\r?\n/);
    const requestedStart = positiveInteger(options.startLine, 1);
    const requestedEnd = positiveInteger(
      options.endLine,
      requestedStart + this.limits.maxReadLines - 1
    );
    if (requestedEnd < requestedStart) {
      throw new Error("Local corpus endLine must be greater than or equal to startLine");
    }

    const startLine = Math.min(requestedStart, Math.max(lines.length, 1));
    const endLine = Math.min(lines.length, requestedEnd, startLine + this.limits.maxReadLines - 1);
    return {
      relativePath: normalizeRelativePath(path.relative(root, canonicalFile)),
      content: lines.slice(startLine - 1, endLine).join("\n"),
      startLine,
      endLine,

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/localCorpus/index.ts:578 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/44be892ebc3481e8. Report an issue: GitHub.