{"record":{"id":"a95e29fa7ae1948e","repo":"earendil-works/pi","slug":"cbor-map-keys-must-be-strings","errorCode":null,"errorMessage":"CBOR map keys must be strings","messagePattern":"CBOR map keys must be strings","errorType":"exception","errorClass":"CborError","httpStatus":null,"severity":"error","filePath":"packages/protocol/src/cbor/decoder.ts","lineNumber":67,"sourceCode":"\t\t\t\ttry {\n\t\t\t\t\treturn textDecoder.decode(bytes);\n\t\t\t\t} catch (_error) {\n\t\t\t\t\tthrow new CborError(\"CBOR text string contains invalid UTF-8\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase 4: {\n\t\t\t\tconst length = this.readLength(additionalInformation, \"array\", this.options.maxContainerLength);\n\t\t\t\tconst result: unknown[] = [];\n\t\t\t\tfor (let index = 0; index < length; index++) result.push(this.readItem(depth + 1));\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tcase 5: {\n\t\t\t\tconst length = this.readLength(additionalInformation, \"map\", this.options.maxContainerLength);\n\t\t\t\tconst result: Record<string, unknown> = {};\n\t\t\t\tconst keys = new Set<string>();\n\t\t\t\tfor (let index = 0; index < length; index++) {\n\t\t\t\t\tconst key = this.readItem(depth + 1);\n\t\t\t\t\tif (typeof key !== \"string\") throw new CborError(\"CBOR map keys must be strings\");\n\t\t\t\t\tif (keys.has(key)) throw new CborError(\"CBOR map contains a duplicate key\");\n\t\t\t\t\tkeys.add(key);\n\t\t\t\t\tObject.defineProperty(result, key, {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tvalue: this.readItem(depth + 1),\n\t\t\t\t\t\twritable: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tcase 6:\n\t\t\t\tthrow new CborError(\"CBOR tags are not supported\");\n\t\t\tcase 7:\n\t\t\t\treturn this.readSimple(additionalInformation);\n\t\t\tdefault:\n\t\t\t\tthrow new CborError(\"Malformed CBOR major type\");\n\t\t}","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/protocol/src/cbor/decoder.ts#L49-L85","documentation":"Error \"CBOR map keys must be strings\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/protocol/src/cbor/decoder.ts:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}