JuliusBrussee/caveman · error · Error
runtime policy response stream returned invalid bytes
Error message
runtime policy response stream returned invalid bytes
What it means
Error "runtime policy response stream returned invalid bytes" thrown in JuliusBrussee/caveman.
Source
Thrown at packages/sdk/typescript/src/index.ts:890
/** Runtime-policy envelopes are KB-sized; stop a hostile body after 1 MiB. */
const RUNTIME_POLICY_MAX_RESPONSE_BYTES = 1024 * 1024;
async function readRuntimePolicyResponseText(response: Response): Promise<string> {
const contentLength = response.headers?.get?.("content-length");
if (typeof contentLength === "string" && /^[0-9]+$/.test(contentLength) && Number(contentLength) > RUNTIME_POLICY_MAX_RESPONSE_BYTES) {
await Promise.resolve(response.body?.cancel?.()).catch(() => undefined);
throw new Error("oversized_response");
}
const reader = response.body?.getReader?.();
if (!reader) throw new Error("bounded_response_unavailable");
const chunks: Uint8Array[] = [];
let total = 0;
try {
while (true) {
const { done, value } = await reader.read();
if (done) break;
if (!(value instanceof Uint8Array)) throw new Error("runtime policy response stream returned invalid bytes");
total += value.byteLength;
if (total > RUNTIME_POLICY_MAX_RESPONSE_BYTES) {
await Promise.resolve(reader.cancel()).catch(() => undefined);
throw new Error("oversized_response");
}
chunks.push(value);
}
} finally {
try {
reader.releaseLock();
} catch {
// A broken fetch implementation must not mask the bounded-read result.
}
}
const joined = new Uint8Array(total);
let offset = 0;
for (const chunk of chunks) {
joined.set(chunk, offset);View on GitHub (pinned to 27d5a3981a)
Solutions
- The runtime policy stream returned invalid bytes; verify the endpoint and proxy, then retry.
When it happens
Trigger: Thrown at packages/sdk/typescript/src/index.ts:890 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/7ac0003f431e0218.
Report an issue: GitHub.