diegosouzapw/OmniRoute · error · Error

Local corpus file type is not permitted

Error message

Local corpus file type is not permitted

What it means

The requested file's extension is not in limits.allowedExtensions for this corpus. This allowlist check fires before any filesystem access, so a forbidden type is rejected without leaking whether the file exists — a content-policy guard, not an accessibility error.

Solutions

  1. Request a file with an allowed extension
  2. Extend allowedExtensions in the corpus limits if the type is safe to serve
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/localCorpus/index.ts:540 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/6ba4b22d878ea1d8. Report an issue: GitHub.

Appendix: source

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

    results.sort(
      (left, right) =>
        right.score - left.score ||
        left.relativePath.localeCompare(right.relativePath) ||
        left.startLine - right.startLine
    );

    return { query: query.trim(), results: results.slice(0, limit), status: this.getStatus() };
  }

  async read(
    inputPath: string,
    options: { startLine?: number; endLine?: number } = {}
  ): Promise<LocalCorpusReadResult> {
    if (!inputPath || path.isAbsolute(inputPath) || hasDeniedSegment(inputPath)) {
      throw new Error("Local corpus file path must be a permitted relative path");
    }
    if (!isAllowedExtension(inputPath, this.limits.allowedExtensions)) {
      throw new Error("Local corpus file type is not permitted");
    }

    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) {

View on GitHub (pinned to a179ffed5b)