diegosouzapw/OmniRoute · error · Error

Local corpus root must be an absolute directory path

Error message

Local corpus root must be an absolute directory path

What it means

Error "Local corpus root must be an absolute directory path" thrown in diegosouzapw/OmniRoute.

Source

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

}

function createSnippet(content: string, query: string, tokens: string[]): string {
  const normalized = content.toLowerCase();
  let matchIndex = normalized.indexOf(query);
  if (matchIndex < 0) matchIndex = normalized.indexOf(tokens[0]);
  if (matchIndex < 0) matchIndex = 0;

  const half = Math.floor(MAX_SNIPPET_CHARS / 2);
  const start = Math.max(0, matchIndex - half);
  const end = Math.min(content.length, start + MAX_SNIPPET_CHARS);
  const prefix = start > 0 ? "…" : "";
  const suffix = end < content.length ? "…" : "";
  return `${prefix}${content.slice(start, end).trim()}${suffix}`;
}

export async function canonicalizeLocalCorpusRoot(inputPath: string): Promise<string> {
  if (!path.isAbsolute(inputPath)) {
    throw new Error("Local corpus root must be an absolute directory path");
  }

  let canonical: string;
  let stat;
  try {
    canonical = await fs.realpath(path.resolve(inputPath));
    stat = await fs.stat(canonical);
  } catch {
    throw new Error("Local corpus root is not accessible");
  }
  if (!stat.isDirectory()) {
    throw new Error("Local corpus root must point to a directory");
  }
  return canonical;
}

export class LocalCorpusIndex {
  private readonly configuredRoot: string;

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/localCorpus/index.ts:270 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/02cb2313afb7ca3b. Report an issue: GitHub.