{"record":{"id":"44be892ebc3481e8","repo":"diegosouzapw/OmniRoute","slug":"local-corpus-file-is-not-valid-text","errorCode":null,"errorMessage":"Local corpus file is not valid text","messagePattern":"Local corpus file is not valid text","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/localCorpus/index.ts","lineNumber":578,"sourceCode":"    }\n\n    let canonicalFile: string;\n    try {\n      canonicalFile = await fs.realpath(resolved);\n    } catch {\n      throw new Error(\"Local corpus file is not accessible\");\n    }\n    if (!isContained(root, canonicalFile)) {\n      throw new Error(\"Local corpus file path escapes the configured root\");\n    }\n\n    let content: string;\n    try {\n      content = await fs.readFile(canonicalFile, \"utf8\");\n    } catch {\n      throw new Error(\"Local corpus file is not accessible\");\n    }\n    if (content.includes(\"\\0\")) throw new Error(\"Local corpus file is not valid text\");\n\n    const lines = content.split(/\\r?\\n/);\n    const requestedStart = positiveInteger(options.startLine, 1);\n    const requestedEnd = positiveInteger(\n      options.endLine,\n      requestedStart + this.limits.maxReadLines - 1\n    );\n    if (requestedEnd < requestedStart) {\n      throw new Error(\"Local corpus endLine must be greater than or equal to startLine\");\n    }\n\n    const startLine = Math.min(requestedStart, Math.max(lines.length, 1));\n    const endLine = Math.min(lines.length, requestedEnd, startLine + this.limits.maxReadLines - 1);\n    return {\n      relativePath: normalizeRelativePath(path.relative(root, canonicalFile)),\n      content: lines.slice(startLine - 1, endLine).join(\"\\n\"),\n      startLine,\n      endLine,","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/localCorpus/index.ts#L560-L596","documentation":"Error \"Local corpus file is not valid text\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/localCorpus/index.ts:578 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"}