paperclipai/paperclip · error

CreateOS process output is invalid.

Error message

CreateOS process output is invalid.

What it means

A data event failed the structural validation of its payload fields: `stream` must be exactly "stdout" or "stderr", and `data_base64` must be a string containing only canonical base64 (with optional padding). Anything else is rejected as corrupt protocol data.

Solutions

  1. Log the offending event and compare its shape with the documented data-event schema.
  2. Align the CreateOS service version with the plugin's protocol expectations.
  3. Remove/repair any intermediary that rewrites base64 payloads or stream names.
  4. Re-run the command; treat the prior process output as untrusted.
  5. Report persistent violations upstream — this indicates server-side protocol corruption.

Example fix

// before
{ "type": "data", "seq": 3, "stream": "std_out", "data_base64": "a Gk=" }
// after
{ "type": "data", "seq": 3, "stream": "stdout", "data_base64": "aGk=" }
Defensive patterns

Strategy: validation

Type guard

function isValidDataEvent(e: Record<string, unknown>): boolean {
  return (e.stream === "stdout" || e.stream === "stderr")
    && typeof e.data_base64 === "string"
    && /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e.data_base64);
}

Try / catch

try { await execute(client, params, signal); }
catch (e) {
  if (e instanceof Error && e.message === "CreateOS process output is invalid.") {
    // capture the event shape for a protocol-bug report; re-run the command
  } else throw e;
}

Prevention

When it happens

Trigger: Server emits a stream value like "std" or "fd3", a missing/null data_base64, or non-canonical base64 (wrong alphabet, whitespace, URL-safe characters, stray padding).

Common situations: CreateOS protocol version mismatch adding new stream kinds; a proxy re-encoding base64 (e.g. URL-safe variant); server bug emitting unencoded or partially encoded bytes.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of paperclipai/paperclip@3f1d897a7c (2026-09-18). Data as JSON: /api/errors/7107cb922d13daec. Report an issue: GitHub.

Appendix: source

Thrown at packages/plugins/sandbox-providers/createos/src/execute.ts:160

          throw new Error("CreateOS process output was evicted before it could be read.");
        }
        if (signal.aborted || (error instanceof CreateosApiError && error.status < 500 && error.status !== 429)) throw error;
        if (++reconnects > 3) throw new Error("CreateOS process output connection failed.");
        await delay(250, undefined, { signal });
        continue;
      }
      try {
        for await (const event of events(response)) {
          if (event.type === "heartbeat") continue;
          if (event.type === "data") {
            const seq = event.seq;
            if (typeof seq !== "number" || !Number.isSafeInteger(seq) || seq < 1) throw new Error("CreateOS process sequence is invalid.");
            if (seq <= cursor) continue;
            if (seq !== cursor + 1) throw new Error("CreateOS process output has a sequence gap.");
            if ((event.stream !== "stdout" && event.stream !== "stderr") ||
                typeof event.data_base64 !== "string" ||
                !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(event.data_base64)) {
              throw new Error("CreateOS process output is invalid.");
            }
            output.write(event.stream, Buffer.from(event.data_base64, "base64"));
            cursor = seq;
          } else if (event.type === "exit") {
            const exitCode = event.exit_code;
            const exitSignal = event.signal;
            if (!(typeof exitCode === "number" && Number.isInteger(exitCode)) &&
                !(typeof exitSignal === "string" && /^SIG[A-Z0-9]+$/.test(exitSignal))) {
              throw new Error("CreateOS process exit status is missing.");
            }
            completed = true;
            output.finish();
            return {
              exitCode: typeof exitCode === "number" ? exitCode : null,
              signal: typeof exitSignal === "string" ? exitSignal : null,
              timedOut: false, stdout: output.stdout, stderr: output.stderr,
              metadata: { processId, outputTruncated: output.truncated },
            };

View on GitHub (pinned to 3f1d897a7c)