{"record":{"id":"f4ff4ec7f03179ec","repo":"Humanizr/Humanizer","slug":"unicode-16-input-input-key-has-sha-256-actual","errorCode":null,"errorMessage":"Unicode 16 input '{input.Key}' has SHA-256 {actual}; expected {input.Value}.","messagePattern":"Unicode 16 input '(.+?)' has SHA-256 (.+?); expected (.+?)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"tools/Humanizer.UnicodeDataGenerator/Program.cs","lineNumber":41,"sourceCode":"    [\"UnicodeData.txt\"] = \"ff58e5823bd095166564a006e47d111130813dcf8bf234ef79fa51a870edb48f\", // DevSkim: ignore DS173237\n    [\"CaseFolding.txt\"] = \"6f1f9c588eb4a5c718d9e8f93b782685e5c7fec872cf05e8e6878053599e09bb\", // DevSkim: ignore DS173237\n    [\"Scripts.txt\"] = \"9e88f0a677df47311106340be8ede2ecdacd9c1c931831218d2be6d5508e0039\", // DevSkim: ignore DS173237\n    [\"ScriptExtensions.txt\"] = \"049117ce26b9769fe2749b06eef51a50a89faef4a97764dd2d81daa715980700\", // DevSkim: ignore DS173237\n    [\"DerivedNormalizationProps.txt\"] = \"4d4c03892dea9146d674b686e495df2d55a28d071ac474041d73518f887abddc\" // DevSkim: ignore DS173237\n};\n\nforeach (var input in inputs)\n{\n    var path = Path.Combine(inputDirectory, input.Key);\n    if (!File.Exists(path))\n    {\n        throw new FileNotFoundException($\"Missing Unicode 16 input '{input.Key}'.\", path);\n    }\n\n    var actual = Convert.ToHexString(SHA256.HashData(File.ReadAllBytes(path))).ToLowerInvariant();\n    if (actual != input.Value)\n    {\n        throw new InvalidOperationException(\n            $\"Unicode 16 input '{input.Key}' has SHA-256 {actual}; expected {input.Value}.\");\n    }\n}\n\nvar unicodeDataPath = Path.Combine(inputDirectory, \"UnicodeData.txt\");\nvar categories = new string?[scalarCount];\nvar uppercaseMappings = new Dictionary<int, int>();\nvar lowercaseMappings = new Dictionary<int, int>();\nReadUnicodeData(\n    unicodeDataPath,\n    categories,\n    uppercaseMappings,\n    lowercaseMappings);\n\nvar unicodeDataFile = Path.Combine(\n    repositoryRoot,\n    \"src\",\n    \"Humanizer\",","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/tools/Humanizer.UnicodeDataGenerator/Program.cs#L23-L59","documentation":"Thrown by the UnicodeDataGenerator when a UCD input file exists but its SHA-256 hash does not match the pinned expected value. The hash pins ensure the generator processes exactly the Unicode 16 dataset; a mismatch means the file is from a different Unicode version or is corrupted.","triggerScenarios":"Running the generator with a UCD file from a different Unicode version (e.g. Unicode 15.1 instead of 16), a partially downloaded file, or a file that was edited. The SHA-256 check at line 38-43 catches it.","commonSituations":"Contributor downloads the wrong Unicode version. Files cached from a previous Unicode release. Truncated download. Git or transfer corruption altering bytes.","solutions":["Re-download the correct Unicode 16 UCD files from the official unicode.org source.","Verify the file integrity with sha256sum and compare against the pinned hashes in Program.cs.","Delete the stale files and fetch fresh copies."],"exampleFix":"# before: stale files cause hash mismatch\n# after: re-download from the Unicode 16 release\nsha256sum ./ucd/UnicodeData.txt\n# compare with expected hash from Program.cs, re-download if mismatch\nwget https://www.unicode.org/Public/16.0.0/ucd/UnicodeData.txt -O ./ucd/UnicodeData.txt","handlingStrategy":"validation","validationCode":"static bool VerifyUcdHash(string path, string expectedSha256)\n{\n    var actual = Convert.ToHexString(\n        SHA256.HashData(File.ReadAllBytes(path))).ToLowerInvariant();\n    return actual == expectedSha256;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always download UCD files from the official Unicode 16 release page.","Run sha256sum on each file and compare to the pins in Program.cs before running the generator.","Clear stale cached downloads before re-fetching."],"tags":["unicode-generator","tooling","hash-mismatch","data-integrity"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}