earendil-works/pi · error · CborError
CBOR length exceeds configured limit of
Error message
CBOR ${kind} length exceeds configured limit of ${limit} What it means
A decoded definite length for a string, array, or map exceeds the configured limit (maxContainerLength or maxByteLength options). This guard exists so a hostile length header cannot force the decoder to allocate or iterate unbounded amounts of memory; it fires before any content bytes are consumed.
Solutions
- Reduce the size of the item or raise the configured limit so the declared length fits.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/protocol/src/cbor/decoder.ts:115 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/1b81f2e01f50f90b.
Report an issue: GitHub.
Appendix: source
Thrown at packages/protocol/src/cbor/decoder.ts:115
const bytes = this.readBytes(8);
const value = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getFloat64(0, false);
if (!Number.isFinite(value)) throw new CborError("Decoded CBOR number must be finite");
if (Number.isInteger(value) && !Number.isSafeInteger(value)) {
throw new CborError("Decoded CBOR integer is outside the safe range");
}
return value;
}
case 31:
throw new CborError("CBOR break marker is not supported");
default:
throw new CborError("Unsupported CBOR simple value or floating-point width");
}
}
private readLength(additionalInformation: number, kind: string, limit: number): number {
if (additionalInformation === 31) throw new CborError(`Indefinite-length CBOR ${kind}s are not supported`);
const length = this.readArgument(additionalInformation);
if (length > limit) throw new CborError(`CBOR ${kind} length exceeds configured limit of ${limit}`);
return length;
}
private readArgument(additionalInformation: number): number {
if (additionalInformation < 24) return additionalInformation;
switch (additionalInformation) {
case 24:
return this.readByte();
case 25: {
const bytes = this.readBytes(2);
return bytes[0]! * 0x100 + bytes[1]!;
}
case 26: {
const bytes = this.readBytes(4);
return bytes[0]! * 0x1_000_000 + bytes[1]! * 0x1_0000 + bytes[2]! * 0x100 + bytes[3]!;
}
case 27: {
const high = this.readArgument(26);View on GitHub (pinned to 4af9d21d3b)