paperclipai/paperclip · error
Cloudflare sandbox bridge streaming command failed.
Error message
Cloudflare sandbox bridge streaming command failed.
What it means
Thrown by `consumeExecuteEventStream` (bridge-client.ts:261) when the SSE stream emits an `error` event whose payload has no usable string `error` field. The bridge's streaming `/exec` endpoint signals command failure by emitting `event: error` with `{ error: "..." }`; if that string is missing/blank, this generic fallback message is used.
Source
Thrown at packages/plugins/sandbox-providers/cloudflare/src/bridge-client.ts:261
const payload = JSON.parse(event.data) as { data?: unknown };
const chunk = typeof payload.data === "string" ? payload.data : "";
if (chunk) {
await options.onOutput?.(event.event, chunk);
}
continue;
}
if (event.event === "complete") {
result = JSON.parse(event.data) as CloudflareBridgeExecuteResponse;
continue;
}
if (event.event === "error") {
const payload = JSON.parse(event.data) as { error?: unknown };
const message = typeof payload.error === "string" && payload.error.trim().length > 0
? payload.error
: "Cloudflare sandbox bridge streaming command failed.";
throw new Error(message);
}
}
if (done) break;
}
if (result) return result;
throw new Error("Cloudflare sandbox bridge streaming response ended without a completion event.");
}
export function createCloudflareBridgeClient(options: BridgeClientOptions) {
const { config } = options;
const apiPrefix = "/api/paperclip-sandbox/v1";
return {
health(extraHeaders?: BridgeClientHeaders): Promise<CloudflareBridgeHealthResponse> {
return requestJson<CloudflareBridgeHealthResponse>(config, `${apiPrefix}/health`, { method: "GET" }, extraHeaders);
},View on GitHub (pinned to 67001ec6eb)
Solutions
- Treat this as a command failure and inspect bridge Worker logs for the real thrown error.
- Update the bridge deployment to a version that always emits a non-empty `error` string in SSE error events.
- Retry the command non-streaming to get a structured result with stdout/stderr/exitCode for diagnostics.
Defensive patterns
Strategy: try-catch
Type guard
function isStreamingCommandFailure(e: unknown): boolean {
return e instanceof Error && /streaming command failed/.test(e.message);
} Try / catch
try {
await client.execute(body, headers, { onOutput });
} catch (err) {
if (isStreamingCommandFailure(err)) {
// re-run non-streaming to capture exitCode/stdout/stderr for diagnosis
const res = await client.execute(body, headers);
log.warn("streaming failed; non-stream result", res);
} else throw err;
} Prevention
- Keep bridge logs accessible — this error means the reason was lost in the SSE event.
- Update the bridge so SSE error events always carry a non-empty error string.
- Re-run non-streaming when the streaming reason is opaque.
When it happens
Trigger: A streaming exec command fails inside the bridge and the Worker emits an SSE `error` event, but the JSON payload's `error` field is absent, non-string, or whitespace-only — so the client cannot surface the bridge's actual failure reason.
Common situations: An uncaught throw inside the bridge's streaming exec handler whose error message was lost (e.g. `String(error)` produced empty), or a bridge version that emits malformed error events. The underlying command failed, but the reason is opaque.
Related errors
- Cloudflare sandbox bridge streaming response had no body.
- Cloudflare sandbox bridge streaming response ended without a
- ${action} failed with exit code ${result.exitCode ?? "null"}
- ${action} timed out: ${result.stderr.trim()}
- Cloudflare sandbox bridge request failed with HTTP ${respons
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/a67d4ddb19d80c80.
Report an issue: GitHub.