earendil-works/pi · error · CborError

Unsupported CBOR value type: ${typeof value}

Error message

Unsupported CBOR value type: ${typeof value}

What it means

Error "Unsupported CBOR value type: ${typeof value}" thrown in earendil-works/pi.

Source

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

			if (entryValue !== undefined) entries.push([key, entryValue]);
		}
		if (entries.length > options.maxContainerLength) {
			throw new CborError(`CBOR map length exceeds configured limit of ${options.maxContainerLength}`);
		}
		ancestors.add(value);
		try {
			writeArgument(writer, 5, entries.length);
			for (const [key, entryValue] of entries) {
				encodeText(writer, key, options);
				encodeValue(writer, entryValue, options, depth + 1, ancestors);
			}
		} finally {
			ancestors.delete(value);
		}
		return;
	}

	throw new CborError(`Unsupported CBOR value type: ${typeof value}`);
}

/** Encodes the protocol's strict, definite-length RFC 8949 subset. */
export function encodeCbor(value: unknown, options?: CborOptions): Uint8Array {
	const resolved = resolveOptions(options);
	const writer = new CborWriter(resolved.maxByteLength);
	encodeValue(writer, value, resolved, 0, new Set<object>());
	return writer.finish();
}

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Only encode supported types: null, boolean, number, string, Uint8Array, arrays, plain objects, and Maps.

When it happens

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