earendil-works/pi · error · CborError

CBOR text string contains invalid UTF-8

Error message

CBOR text string contains invalid UTF-8

What it means

Error "CBOR text string contains invalid UTF-8" thrown in earendil-works/pi.

Source

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

		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: {
				const length = this.readLength(additionalInformation, "text string", this.options.maxByteLength);
				const bytes = this.readBytes(length);
				try {
					return textDecoder.decode(bytes);
				} catch (_error) {
					throw new CborError("CBOR text string contains invalid UTF-8");
				}
			}
			case 4: {
				const length = this.readLength(additionalInformation, "array", this.options.maxContainerLength);
				const result: unknown[] = [];
				for (let index = 0; index < length; index++) result.push(this.readItem(depth + 1));
				return result;
			}
			case 5: {
				const length = this.readLength(additionalInformation, "map", this.options.maxContainerLength);
				const result: Record<string, unknown> = {};
				const keys = new Set<string>();
				for (let index = 0; index < length; index++) {
					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, {

View on GitHub (pinned to 4af9d21d3b)

When it happens

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