earendil-works/pi · error · CborError

CBOR byte length exceeds configured limit of ${this.maxByteL

Error message

CBOR byte length exceeds configured limit of ${this.maxByteLength}

What it means

Error "CBOR byte length exceeds configured limit of ${this.maxByteLength}" thrown in earendil-works/pi.

Source

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

		this.writeUint32(high);
		this.writeUint32(low);
	}

	writeFloat64(value: number): void {
		this.ensureCapacity(9);
		this.buffer[this.offset] = 0xfb;
		new DataView(this.buffer.buffer).setFloat64(this.offset + 1, value, false);
		this.offset += 9;
	}

	finish(): Uint8Array {
		return this.buffer.slice(0, this.offset);
	}

	private ensureCapacity(additionalBytes: number): void {
		const required = this.offset + additionalBytes;
		if (required > this.maxByteLength) {
			throw new CborError(`CBOR byte length exceeds configured limit of ${this.maxByteLength}`);
		}
		if (required <= this.buffer.byteLength) return;

		let capacity = Math.max(1, this.buffer.byteLength);
		while (capacity < required) capacity = Math.min(this.maxByteLength, Math.max(required, capacity * 2));
		const expanded = new Uint8Array(capacity);
		expanded.set(this.buffer);
		this.buffer = expanded;
	}
}

function writeArgument(writer: CborWriter, majorType: number, value: number): void {
	const prefix = majorType << 5;
	if (value < 24) {
		writer.writeByte(prefix | value);
	} else if (value <= 0xff) {
		writer.writeByte(prefix | 24);
		writer.writeByte(value);

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Reduce the encoded value size or raise the encoder's maxByteLength limit.

When it happens

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