{"record":{"id":"8b59acff7644259d","repo":"rust-lang/rust","slug":"unknown-mapping-kind-raw-mapping-kind-x","errorCode":null,"errorMessage":"unknown mapping kind: {raw_mapping_kind:#x}","messagePattern":"unknown mapping kind: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/tools/coverage-dump/src/covfun.rs","lineNumber":237,"sourceCode":"                    let conditions_num = self.read_uleb128_u32()?;\n                    Ok(MappingKind::MCDCDecision { bitmap_idx, conditions_num })\n                }\n                6 => {\n                    let r#true = self.read_simple_term()?;\n                    let r#false = self.read_simple_term()?;\n                    let condition_id = self.read_uleb128_u32()?;\n                    let true_next_id = self.read_uleb128_u32()?;\n                    let false_next_id = self.read_uleb128_u32()?;\n                    Ok(MappingKind::MCDCBranch {\n                        r#true,\n                        r#false,\n                        condition_id,\n                        true_next_id,\n                        false_next_id,\n                    })\n                }\n\n                _ => Err(anyhow!(\"unknown mapping kind: {raw_mapping_kind:#x}\")),\n            }\n        }\n    }\n\n    fn read_raw_mapping_region(&mut self) -> anyhow::Result<MappingRegion> {\n        let start_line_offset = self.read_uleb128_u32()?;\n        let start_column = self.read_uleb128_u32()?;\n        let end_line_offset = self.read_uleb128_u32()?;\n        let end_column = self.read_uleb128_u32()?;\n        Ok(MappingRegion { start_line_offset, start_column, end_line_offset, end_column })\n    }\n}\n\n/// Enum that can hold a constant zero value, the ID of an physical coverage\n/// counter, or the ID (and operation) of a coverage-counter expression.\n///\n/// Terms are used as the operands of coverage-counter expressions, as the arms\n/// of branch mappings, and as the value of code/gap mappings.","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/src/tools/coverage-dump/src/covfun.rs#L219-L255","documentation":"Thrown by read_raw_mapping_kind in coverage-dump when the decoded raw mapping-kind ULEB128 value (after the low two bits are checked and found non-code) has a high-nibble value not in {0,2,4,5,6}. Known kinds: 0=zero/code-handled, 2=Skip, 4=Branch, 5=MCDCDecision, 6=MCDCBranch. Any other value means the payload contains an unrecognized mapping kind, typically from a newer LLVM or a corrupt payload.","triggerScenarios":"An LLVM version introduced a new mapping kind whose discriminant is not yet recognized by coverage-dump; the coverage payload is corrupted or misaligned so a ULEB128 read consumes the wrong bytes; version skew between producer and dumper.","commonSituations":"Upgrading LLVM added a new mapping variant; reading a covfun payload from a different/older format; byte-level corruption of the __llvm_covfun section.","solutions":["Verify the coverage artifact comes from an LLVM whose mapping kinds are all in the set coverage-dump knows.","If LLVM added a new kind, add a match arm in read_raw_mapping_kind with its discriminant and decoding logic.","Re-generate the coverage data to rule out corruption.","Inspect the raw bytes printed just above the error to confirm the ULEB128 decode is consuming the expected offset."],"exampleFix":"// before\nmatch high {\n    0 => unreachable!(...),\n    2 => Ok(MappingKind::Skip),\n    4 => Ok(MappingKind::Branch { ... }),\n    5 => Ok(MappingKind::MCDCDecision { ... }),\n    6 => Ok(MappingKind::MCDCBranch { ... }),\n    _ => Err(anyhow!(\"unknown mapping kind: {raw_mapping_kind:#x}\")),\n}\n\n// after (add the new LLVM mapping kind, e.g. discriminant 7)\n    7 => Ok(MappingKind::NewKind { ... }),\n    _ => Err(anyhow!(\"unknown mapping kind: {raw_mapping_kind:#x}\")),","handlingStrategy":"try-catch","validationCode":"// No general caller-side validation is possible for opaque ULEB128 discriminants.\n// Ensure producer/dumper LLVM versions match before dumping.","typeGuard":null,"tryCatchPattern":"if let Err(e) = dump_covfun_mappings(llvm_ir, &filename_tables, &function_names) {\n    if let Some(m) = e.to_string().strip_prefix(\"unknown mapping kind: \") {\n        eprintln!(\"Unrecognized mapping kind {m}; update coverage-dump for this LLVM version.\");\n    }\n    return Err(e);\n}","preventionTips":["Match coverage-dump's version to the LLVM that emitted the coverage.","When LLVM adds a mapping kind, extend read_raw_mapping_kind in the same change.","Inspect the raw-bytes hex dump printed above the error to confirm alignment."],"tags":["coverage-dump","llvm","coverage","parsing","version-skew"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}