{"record":{"id":"8b29eed5bef78009","repo":"paperclipai/paperclip","slug":"createos-process-output-was-evicted-before-it-could-be-read","errorCode":null,"errorMessage":"CreateOS process output was evicted before it could be read.","messagePattern":"CreateOS process output was evicted before it could be read\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/plugins/sandbox-providers/createos/src/execute.ts","lineNumber":142,"sourceCode":"      if (error instanceof CreateosApiError && error.status < 500) creationMayHaveSucceeded = false;\n      throw error;\n    }\n    processId = identifier(created.process_id);\n    // No interactive stdin for ordinary commands; any supplied input comes\n    // from the staged file, avoiding a write-vs-fast-exit race.\n    try { await client.json(`${base}/${processId}/stdin/close`, \"POST\", undefined, signal); }\n    catch (error) {\n      if (!(error instanceof CreateosApiError && error.status === 409)) throw error;\n    }\n    let reconnects = 0;\n    for (;;) {\n      signal.throwIfAborted();\n      let response: Response;\n      try {\n        response = await client.request(`${base}/${processId}/connect?after=${cursor}`, { signal });\n      } catch (error) {\n        if (error instanceof CreateosApiError && error.status === 410) {\n          throw new Error(\"CreateOS process output was evicted before it could be read.\");\n        }\n        if (signal.aborted || (error instanceof CreateosApiError && error.status < 500 && error.status !== 429)) throw error;\n        if (++reconnects > 3) throw new Error(\"CreateOS process output connection failed.\");\n        await delay(250, undefined, { signal });\n        continue;\n      }\n      try {\n        for await (const event of events(response)) {\n          if (event.type === \"heartbeat\") continue;\n          if (event.type === \"data\") {\n            const seq = event.seq;\n            if (typeof seq !== \"number\" || !Number.isSafeInteger(seq) || seq < 1) throw new Error(\"CreateOS process sequence is invalid.\");\n            if (seq <= cursor) continue;\n            if (seq !== cursor + 1) throw new Error(\"CreateOS process output has a sequence gap.\");\n            if ((event.stream !== \"stdout\" && event.stream !== \"stderr\") ||\n                typeof event.data_base64 !== \"string\" ||\n                !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(event.data_base64)) {\n              throw new Error(\"CreateOS process output is invalid.\");","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/packages/plugins/sandbox-providers/createos/src/execute.ts#L124-L160","documentation":"Reconnecting to a CreateOS process's output stream returned HTTP 410 Gone, meaning the server has already evicted the buffered output for that process (the requested `after` cursor offset is expired). The plugin maps this to a distinct error because the process may still be running but its past output can never be recovered.","triggerScenarios":"Calling execute with a long delay before reading output, a long-running process whose output buffer exceeds the server retention window, or reconnecting to a process whose output ring buffer rotated past the client's cursor, so the /connect?after=N request answers 410.","commonSituations":"Very chatty process producing megabytes of output while the client is slow or paused (e.g. under debugger/network stall); undersized CreateOS output-retention setting; resuming after a long outage where the process kept running.","solutions":["Consume the output stream promptly; avoid long pauses between process creation and the first /connect call.","Reduce process output volume or redirect it to a sandbox file and read it back via /files.","Increase the CreateOS server's output retention/buffer size if you control it.","Catch this error and re-run the command, treating the previous run's stdout/stderr as lost.","Do not simply retry the same process: the missing output cannot be recovered from it."],"exampleFix":"// before\nspawn(); await longPreparation(); connect(after=0)  // output may be evicted\n// after\nconst p = spawn(); const out = connect(p, after=0); await longPreparation(); // read first","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const r = await execute(client, params, signal); }\ncatch (e) {\n  if (e instanceof Error && e.message.includes(\"output was evicted\")) {\n    // output unrecoverable; re-run command, do not retry same process\n  } else throw e;\n}","preventionTips":["Connect to the output stream immediately after process creation.","Avoid long client-side pauses while a chatty process runs.","Redirect very large output to sandbox files instead of the stream buffer.","Size the server's output retention window for your worst-case read latency."],"tags":["streaming","http-410","eviction"],"backgroundTag":"process-output-evicted","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"}