{"record":{"id":"e97f668a4769659b","repo":"paperclipai/paperclip","slug":"createos-process-stream-reported-an-error","errorCode":null,"errorMessage":"CreateOS process stream reported an error.","messagePattern":"CreateOS process stream reported an error\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/plugins/sandbox-providers/createos/src/execute.ts","lineNumber":180,"sourceCode":"            output.write(event.stream, Buffer.from(event.data_base64, \"base64\"));\n            cursor = seq;\n          } else if (event.type === \"exit\") {\n            const exitCode = event.exit_code;\n            const exitSignal = event.signal;\n            if (!(typeof exitCode === \"number\" && Number.isInteger(exitCode)) &&\n                !(typeof exitSignal === \"string\" && /^SIG[A-Z0-9]+$/.test(exitSignal))) {\n              throw new Error(\"CreateOS process exit status is missing.\");\n            }\n            completed = true;\n            output.finish();\n            return {\n              exitCode: typeof exitCode === \"number\" ? exitCode : null,\n              signal: typeof exitSignal === \"string\" ? exitSignal : null,\n              timedOut: false, stdout: output.stdout, stderr: output.stderr,\n              metadata: { processId, outputTruncated: output.truncated },\n            };\n          } else if (event.type === \"error\") {\n            throw new Error(event.error === \"output_offset_expired\"\n              ? \"CreateOS process output was evicted before it could be read.\"\n              : \"CreateOS process stream reported an error.\");\n          } else {\n            throw new Error(\"CreateOS returned an unknown process event.\");\n          }\n        }\n      } catch (error) {\n        // Network read failures can resume from the last accepted sequence.\n        // Protocol errors must fail closed rather than reconnect past bad data.\n        if (!(error instanceof TypeError) || signal.aborted) throw error;\n      }\n      if (++reconnects > 3) throw new Error(\"CreateOS process stream ended without an exit status.\");\n      await delay(250, undefined, { signal });\n    }\n  } catch (error) {\n    if (creationMayHaveSucceeded && !processId) {\n      throw new CreateosCleanupError(\"CreateOS process creation could not be confirmed; destroy the lease before reusing it.\");\n    }","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/packages/plugins/sandbox-providers/createos/src/execute.ts#L162-L198","documentation":"The CreateOS sandbox provider streams process events over an HTTP SSE-like connection. When the server sends an event of type 'error' that is not the recognized 'output_offset_expired' case, execute() throws this generic stream-error message. It signals the remote sandbox reported a failure while running the process and there is no more-specific classification available.","triggerScenarios":"A process event with type === 'error' and event.error !== 'output_offset_expired' arrives while reading the stream in execute(). This happens on sandbox-side failures: the process was killed by the host, an internal sandbox error occurred, or the runtime could not continue the process.","commonSituations":"Sandbox instance crashed or was recycled mid-run; CreateOS runtime internal error; process killed by OOM or host policy; server-side bug emitting an unrecognized error code.","solutions":["Inspect the sandbox logs / lease state in CreateOS to find the underlying process failure reason.","Retry the command on a freshly created sandbox lease in case the previous sandbox was unhealthy.","Capture stdout/stderr accumulated so far (they are thrown away by this throw) by wrapping the call and logging before propagation.","Check sandbox resource limits (memory, CPU) and reduce workload or increase the lease size."],"exampleFix":"// before\nthrow new Error(\"CreateOS process stream reported an error.\");\n// after\nthrow new Error(`CreateOS process stream reported an error: ${event.error ?? \"unknown\"}`);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const result = await execute(lease, cmd, { signal });\n} catch (e) {\n  if (e.message === \"CreateOS process stream reported an error.\") {\n    log.warn(\"sandbox stream error, consider recreating lease\", { leaseId: lease.id });\n    throw new TransientSandboxError(e);\n  }\n  throw e;\n}","preventionTips":["Monitor sandbox health and recreate leases that show repeated stream errors.","Keep stdout/stderr captured incrementally so partial output survives stream failures.","Set sane process resource limits to avoid OOM kills inside the sandbox.","Keep the createos plugin and server on compatible versions."],"tags":["sandbox","stream","process","remote-execution"],"backgroundTag":"api-error-response","analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}