earendil-works/pi · error · CborError

CBOR nesting depth exceeds configured limit of ${options.max

Error message

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

What it means

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

Source

Thrown at packages/protocol/src/cbor/encoder.ts:127

	const bytes = textEncoder.encode(value);
	if (bytes.byteLength > options.maxByteLength) {
		throw new CborError(`CBOR text string length exceeds configured limit of ${options.maxByteLength}`);
	}
	if (textDecoder.decode(bytes) !== value)
		throw new CborError("CBOR text strings must contain valid Unicode scalar values");
	writeArgument(writer, 3, bytes.byteLength);
	writer.writeBytes(bytes);
}

function encodeValue(
	writer: CborWriter,
	value: unknown,
	options: ResolvedCborOptions,
	depth: number,
	ancestors: Set<object>,
): void {
	if (depth > options.maxDepth)
		throw new CborError(`CBOR nesting depth exceeds configured limit of ${options.maxDepth}`);

	if (value === null) {
		writer.writeByte(0xf6);
		return;
	}
	if (typeof value === "boolean") {
		writer.writeByte(value ? 0xf5 : 0xf4);
		return;
	}
	if (typeof value === "number") {
		if (!Number.isFinite(value)) throw new CborError("CBOR numbers must be finite");
		if (Number.isInteger(value) && !Object.is(value, -0)) {
			if (!Number.isSafeInteger(value)) throw new CborError("CBOR integers must be safe JavaScript integers");
			if (value >= 0) writeArgument(writer, 0, value);
			else writeArgument(writer, 1, -1 - value);
		} else {
			writer.writeFloat64(value);
		}

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Flatten the nested value or raise options.maxDepth.

When it happens

Trigger: Thrown at packages/protocol/src/cbor/encoder.ts:127 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/e24fb77dc120bb2c. Report an issue: GitHub.