{"record":{"id":"fdcd3ebf6e88046c","repo":"paperclipai/paperclip","slug":"createos-process-frame-is-too-large","errorCode":null,"errorMessage":"CreateOS process frame is too large.","messagePattern":"CreateOS process frame is too large\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/plugins/sandbox-providers/createos/src/execute.ts","lineNumber":45,"sourceCode":"    params.cwd ? `cd -- ${shellQuote(params.cwd)} || exit` : \"\",\n    `exec env ${env.join(\" \")} ${command}${stdinPath ? ` < ${shellQuote(stdinPath)}` : \"\"}`,\n  ].filter(Boolean).join(\"\\n\");\n}\n\nasync function* events(response: Response): AsyncGenerator<Record<string, unknown>> {\n  if (!response.body) throw new Error(\"CreateOS returned an empty process stream.\");\n  const reader = response.body.getReader();\n  const decoder = new TextDecoder();\n  let pending = \"\";\n  try {\n    for (;;) {\n      const { value, done } = await reader.read();\n      pending += done ? decoder.decode() : decoder.decode(value, { stream: true });\n      let newline: number;\n      while ((newline = pending.indexOf(\"\\n\")) >= 0) {\n        const line = pending.slice(0, newline);\n        pending = pending.slice(newline + 1);\n        if (line.length > MAX_LINE_BYTES) throw new Error(\"CreateOS process frame is too large.\");\n        if (line.trim()) yield parseEvent(line);\n      }\n      if (pending.length > MAX_LINE_BYTES) throw new Error(\"CreateOS process frame is too large.\");\n      if (done) {\n        if (pending.trim()) yield parseEvent(pending);\n        return;\n      }\n    }\n  } finally {\n    await reader.cancel().catch(() => undefined);\n    reader.releaseLock();\n  }\n}\n\nfunction parseEvent(line: string): Record<string, unknown> {\n  try { return object(JSON.parse(line)); }\n  catch { throw new Error(\"CreateOS returned an invalid process frame.\"); }\n}","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/packages/plugins/sandbox-providers/createos/src/execute.ts#L27-L63","documentation":"A newline-delimited JSON frame read from the CreateOS process output stream exceeded the 1 MiB MAX_LINE_BYTES limit. The plugin throws this to prevent unbounded memory growth when buffering stream lines; a frame this large is not a legitimate CreateOS event. It can be raised both for a completed line (line 45) and for an unterminated line still accumulating in `pending` (line 48).","triggerScenarios":"The CreateOS sandbox /processes/:id/connect SSE-style stream emits a single JSON line longer than 1,048,576 characters — e.g. a `data` event whose data_base64 payload encodes more than ~780 KiB written to stdout/stderr between newlines, or a server sending one giant line without newline framing.","commonSituations":"A sandbox command dumps a huge single-line blob (base64 JSON, minified output) to stdout; a misbehaving or non-CreateOS server behind the connect endpoint sends garbage or oversized frames; a version change in the CreateOS service batches output differently, removing newline boundaries.","solutions":["Split large output inside the sandbox command before printing (chunk writes with newlines, or write to a file and read it via /files instead of stdout).","Check which output stream produced the huge line (stdout/stderr) and reduce per-line verbosity, e.g. `tail`/`head`/filters before printing.","Verify the CreateOS service version matches the frame protocol this plugin expects (newline-delimited JSON events with bounded size).","If you control the server, raise the frame cap or ensure heartbeats/newlines flush output regularly.","Catch the error and re-run the command with output redirected to a sandbox file, fetching it in bounded chunks afterward."],"exampleFix":"// before\n./dump-all --json | base64 -w0   # one gigantic line on stdout\n// after\n./dump-all --json | base64 -w76  # wraps output across <1MiB lines","handlingStrategy":"validation","validationCode":"// Estimate worst-case frame size before running\nconst approxBytes = Buffer.byteLength(command) + Number(params.env?.PAYLOAD_SIZE ?? 0);\nif (approxBytes > 780_000) throw new Error(\"Expected single-line output exceeds the 1MiB CreateOS frame cap; use a file instead.\");","typeGuard":"function isWithinFrameCap(line: string): boolean { return line.length <= 1_048_576; }","tryCatchPattern":"try { await execute(client, params, signal); }\ncatch (e) {\n  if (e instanceof Error && e.message.includes(\"frame is too large\")) {\n    // re-run with output redirected to a sandbox file and chunked\n  } else throw e;\n}","preventionTips":["Make sandbox commands emit newline-wrapped output (e.g. base64 -w76, fold -w).","Avoid dumping large single-line blobs to stdout/stderr; use files plus the /files API.","Keep expected output volume well under 1 MiB per line in command design.","Pin and test against the CreateOS service version you deploy with."],"tags":["streaming","payload-size","sandbox"],"backgroundTag":"payload-too-large","analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}