earendil-works/pi · error · CborError

CBOR nesting depth exceeds configured limit of ${this.option

Error message

CBOR nesting depth exceeds configured limit of ${this.options.maxDepth}

What it means

Error "CBOR nesting depth exceeds configured limit of ${this.options.maxDepth}" thrown in earendil-works/pi.

Source

Thrown at packages/protocol/src/cbor/decoder.ts:28

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;
			}
			case 2: {
				const length = this.readLength(additionalInformation, "byte string", this.options.maxByteLength);
				return new Uint8Array(this.readBytes(length));
			}
			case 3: {

View on GitHub (pinned to 4af9d21d3b)

When it happens

Trigger: Thrown at packages/protocol/src/cbor/decoder.ts:28 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/f59f4e288a021480. Report an issue: GitHub.