{"record":{"id":"752038399d6bc6f3","repo":"diegosouzapw/OmniRoute","slug":"skill-file-exceeds-the-max-file-bytes-byte-read","errorCode":null,"errorMessage":"Skill file exceeds the ${MAX_FILE_BYTES} byte read limit","messagePattern":"Skill file exceeds the (.+?) byte read limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/skills/builtins.ts","lineNumber":214,"sourceCode":"\nexport const builtinSkills: Record<string, SkillHandler> = {\n  file_read: async (input, context) => {\n    const { path: inputPath, encoding = \"utf8\" } = input as {\n      path: string;\n      encoding?: BufferEncoding;\n    };\n    if (!inputPath || typeof inputPath !== \"string\") {\n      throw new Error(\"Missing required field: path\");\n    }\n    if (encoding !== \"utf8\" && encoding !== \"base64\") {\n      throw new Error(\"Unsupported encoding. Use utf8 or base64.\");\n    }\n\n    const { resolved, relative } = resolveWorkspacePath(inputPath, context);\n    const stat = await fs.stat(resolved);\n    if (!stat.isFile()) throw new Error(\"Skill file path must point to a file\");\n    if (stat.size > MAX_FILE_BYTES) {\n      throw new Error(`Skill file exceeds the ${MAX_FILE_BYTES} byte read limit`);\n    }\n\n    return {\n      success: true,\n      path: relative,\n      content: await fs.readFile(resolved, encoding),\n      bytesRead: stat.size,\n      encoding,\n      context: context.apiKeyId,\n    };\n  },\n\n  file_write: async (input, context) => {\n    const {\n      path: inputPath,\n      content,\n      append = false,\n      overwrite = true,","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/skills/builtins.ts#L196-L232","documentation":"Size-limit guard in file_read: fs.stat reported the target file is larger than MAX_FILE_BYTES, the per-read cap that keeps skill responses bounded. The file exists and is readable, but returning its full content would blow the response budget, so the read is refused rather than truncated.","triggerScenarios":"Thrown at src/lib/skills/builtins.ts:214 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read a smaller file or split the target into chunks under the limit","Use base64 only if truly needed — it inflates size; prefer utf8 text","Raise MAX_FILE_BYTES in server configuration if large reads are required"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}