diegosouzapw/OmniRoute · error · Error

Local corpus root is not accessible

Error message

Local corpus root is not accessible

What it means

canonicalizeLocalCorpusRoot caught a filesystem error while resolving (fs.realpath) or stat-ing the corpus root: the path does not exist, is not reachable, or the process lacks permission. The underlying OS error is deliberately swallowed so the throw site only reports inaccessibility.

Solutions

  1. Verify the directory exists and the server process has read/execute permission
  2. Fix stale mounts or symlinks pointing at unmounted targets
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/lib/localCorpus/index.ts:279 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/4b8ff516412ec8b7. Report an issue: GitHub.

Appendix: source

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

  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;
  private readonly limits: ResolvedLimits;
  private canonicalRoot: string | null = null;
  private files = new Map<string, IndexedCorpusFile>();
  private lastIndexedAt: number | null = null;
  private truncated = false;
  private refreshPromise: Promise<LocalCorpusRefreshResult> | null = null;

  constructor(rootPath: string, limits: LocalCorpusLimits = {}) {
    this.configuredRoot = rootPath;

View on GitHub (pinned to a179ffed5b)