earendil-works/pi · error · CborError

Malformed CBOR major type

Error message

Malformed CBOR major type

What it means

Error "Malformed CBOR major type" thrown in earendil-works/pi.

Source

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

					const key = this.readItem(depth + 1);
					if (typeof key !== "string") throw new CborError("CBOR map keys must be strings");
					if (keys.has(key)) throw new CborError("CBOR map contains a duplicate key");
					keys.add(key);
					Object.defineProperty(result, key, {
						configurable: true,
						enumerable: true,
						value: this.readItem(depth + 1),
						writable: true,
					});
				}
				return result;
			}
			case 6:
				throw new CborError("CBOR tags are not supported");
			case 7:
				return this.readSimple(additionalInformation);
			default:
				throw new CborError("Malformed CBOR major type");
		}
	}

	private readSimple(additionalInformation: number): unknown {
		switch (additionalInformation) {
			case 20:
				return false;
			case 21:
				return true;
			case 22:
				return null;
			case 27: {
				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");
				}

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. The input is not valid CBOR. Verify the payload comes from a compliant CBOR encoder and was not corrupted in transit.

When it happens

Trigger: Thrown at packages/protocol/src/cbor/decoder.ts:84 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/940f6828fc25ea99. Report an issue: GitHub.