earendil-works/pi · error · CborError
CBOR payload contains trailing data
Error message
CBOR payload contains trailing data
What it means
Error "CBOR payload contains trailing data" thrown in earendil-works/pi.
Source
Thrown at packages/protocol/src/cbor/decoder.ts:22
type ResolvedCborOptions,
resolveOptions,
textDecoder,
UINT32_BASE,
} from "./options.ts";
class CborReader {
private readonly bytes: Uint8Array;
private offset = 0;
private readonly options: ResolvedCborOptions;
constructor(bytes: Uint8Array, options: ResolvedCborOptions) {
this.bytes = bytes;
this.options = options;
}
decode(): unknown {
const value = this.readItem(0);
if (this.offset !== this.bytes.byteLength) throw new CborError("CBOR payload contains trailing data");
return value;
}
private readItem(depth: number): unknown {
if (depth > this.options.maxDepth) {
throw new CborError(`CBOR nesting depth exceeds configured limit of ${this.options.maxDepth}`);
}
const initial = this.readByte();
const majorType = initial >>> 5;
const additionalInformation = initial & 0x1f;
switch (majorType) {
case 0:
return this.readArgument(additionalInformation);
case 1: {
const value = -1 - this.readArgument(additionalInformation);
if (!Number.isSafeInteger(value)) throw new CborError("Decoded CBOR integer is outside the safe range");
return value;View on GitHub (pinned to 4af9d21d3b)
When it happens
Trigger: Thrown at packages/protocol/src/cbor/decoder.ts:22 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/ad0f9a7bb0cb41d3.
Report an issue: GitHub.