diegosouzapw/OmniRoute · error

Skill file exceeds the

Error message

Skill file exceeds the ${MAX_FILE_BYTES} byte read limit

What it means

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.

Solutions

  1. Read a smaller file or split the target into chunks under the limit
  2. Use base64 only if truly needed — it inflates size; prefer utf8 text
  3. Raise MAX_FILE_BYTES in server configuration if large reads are required
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/skills/builtins.ts:214 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/752038399d6bc6f3. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/skills/builtins.ts:214

export const builtinSkills: Record<string, SkillHandler> = {
  file_read: async (input, context) => {
    const { path: inputPath, encoding = "utf8" } = input as {
      path: string;
      encoding?: BufferEncoding;
    };
    if (!inputPath || typeof inputPath !== "string") {
      throw new Error("Missing required field: path");
    }
    if (encoding !== "utf8" && encoding !== "base64") {
      throw new Error("Unsupported encoding. Use utf8 or base64.");
    }

    const { resolved, relative } = resolveWorkspacePath(inputPath, context);
    const stat = await fs.stat(resolved);
    if (!stat.isFile()) throw new Error("Skill file path must point to a file");
    if (stat.size > MAX_FILE_BYTES) {
      throw new Error(`Skill file exceeds the ${MAX_FILE_BYTES} byte read limit`);
    }

    return {
      success: true,
      path: relative,
      content: await fs.readFile(resolved, encoding),
      bytesRead: stat.size,
      encoding,
      context: context.apiKeyId,
    };
  },

  file_write: async (input, context) => {
    const {
      path: inputPath,
      content,
      append = false,
      overwrite = true,

View on GitHub (pinned to a179ffed5b)