{"record":{"id":"56b0c08c570a1106","repo":"FiloSottile/age","slug":"invalid-checksum","errorCode":null,"errorMessage":"invalid checksum","messagePattern":"invalid checksum","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/bech32/bech32.go","lineNumber":173,"sourceCode":"\t\t}\n\t}\n\tfor p, c := range s[pos+1:] {\n\t\t// Fold ASCII explicitly. Unicode case folding can turn a non-ASCII\n\t\t// rune into a shorter valid charset member.\n\t\tif c >= 'A' && c <= 'Z' {\n\t\t\tc += 'a' - 'A'\n\t\t}\n\t\td := strings.IndexRune(charset, c)\n\t\tif d == -1 {\n\t\t\treturn \"\", nil, fmt.Errorf(\"invalid character data part: s[%d]=%v\", p, c)\n\t\t}\n\t\tdata = append(data, byte(d))\n\t}\n\tif len(data) < 6 {\n\t\treturn \"\", nil, fmt.Errorf(\"data part too short\")\n\t}\n\tif !verifyChecksum(hrp, data) {\n\t\treturn \"\", nil, fmt.Errorf(\"invalid checksum\")\n\t}\n\tdata, err = convertBits(data[:len(data)-6], 5, 8, false)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\treturn hrp, data, nil\n}\n","sourceCodeStart":155,"sourceCodeEnd":181,"githubUrl":"https://github.com/FiloSottile/age/blob/b74dce4cdbe35b5e5f66c06d9612b72f89028758/internal/bech32/bech32.go#L155-L181","documentation":"The final 6 data characters are a BCH checksum over the HRP and payload. If verifyChecksum fails, the string was corrupted or mistyped somewhere — the library cannot trust the decoded payload.","triggerScenarios":"Decode with any single-character typo, transposition, wrong-case HRP mismatch (checksum covers the HRP), or hand-edited key.","commonSituations":"Manual transcription of age keys, editing a key file by hand, mixed-case input where the HRP case doesn't match the checksum computation, network/markdown mangling of the string.","solutions":["Re-copy the original key exactly; do not hand-edit","Fix single-character typos systematically (the checksum cannot suggest a correction)","Confirm case handling: the string must be all-lowercase or all-uppercase"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// The library is the validator; pre-check case consistency at minimum:\nif strings.ToLower(s) != s && strings.ToUpper(s) != s {\n    return errors.New(\"mixed case bech32 input\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never edit key strings by hand","Keep bech32 strings single-case end to end","Treat checksum failure as corruption, not something to retry — re-source the key"],"tags":["bech32","checksum","integrity"],"backgroundTag":"bech32-checksum-mismatch","analyzedSha":"b74dce4cdbe35b5e5f66c06d9612b72f89028758","analyzedAt":"2026-08-31T23:59:31.627Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}