{"record":{"id":"02cb2313afb7ca3b","repo":"diegosouzapw/OmniRoute","slug":"local-corpus-root-must-be-an-absolute-directory-pa","errorCode":null,"errorMessage":"Local corpus root must be an absolute directory path","messagePattern":"Local corpus root must be an absolute directory path","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/localCorpus/index.ts","lineNumber":270,"sourceCode":"}\n\nfunction createSnippet(content: string, query: string, tokens: string[]): string {\n  const normalized = content.toLowerCase();\n  let matchIndex = normalized.indexOf(query);\n  if (matchIndex < 0) matchIndex = normalized.indexOf(tokens[0]);\n  if (matchIndex < 0) matchIndex = 0;\n\n  const half = Math.floor(MAX_SNIPPET_CHARS / 2);\n  const start = Math.max(0, matchIndex - half);\n  const end = Math.min(content.length, start + MAX_SNIPPET_CHARS);\n  const prefix = start > 0 ? \"…\" : \"\";\n  const suffix = end < content.length ? \"…\" : \"\";\n  return `${prefix}${content.slice(start, end).trim()}${suffix}`;\n}\n\nexport async function canonicalizeLocalCorpusRoot(inputPath: string): Promise<string> {\n  if (!path.isAbsolute(inputPath)) {\n    throw new Error(\"Local corpus root must be an absolute directory path\");\n  }\n\n  let canonical: string;\n  let stat;\n  try {\n    canonical = await fs.realpath(path.resolve(inputPath));\n    stat = await fs.stat(canonical);\n  } catch {\n    throw new Error(\"Local corpus root is not accessible\");\n  }\n  if (!stat.isDirectory()) {\n    throw new Error(\"Local corpus root must point to a directory\");\n  }\n  return canonical;\n}\n\nexport class LocalCorpusIndex {\n  private readonly configuredRoot: string;","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/localCorpus/index.ts#L252-L288","documentation":"Error \"Local corpus root must be an absolute directory path\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/localCorpus/index.ts:270 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}