Humanizr/Humanizer · error · InvalidOperationException
Unicode 16 input '{input.Key}' has SHA-256 {actual}; expecte
Error message
Unicode 16 input '{input.Key}' has SHA-256 {actual}; expected {input.Value}. What it means
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.
Source
Thrown at tools/Humanizer.UnicodeDataGenerator/Program.cs:41
["UnicodeData.txt"] = "ff58e5823bd095166564a006e47d111130813dcf8bf234ef79fa51a870edb48f", // DevSkim: ignore DS173237
["CaseFolding.txt"] = "6f1f9c588eb4a5c718d9e8f93b782685e5c7fec872cf05e8e6878053599e09bb", // DevSkim: ignore DS173237
["Scripts.txt"] = "9e88f0a677df47311106340be8ede2ecdacd9c1c931831218d2be6d5508e0039", // DevSkim: ignore DS173237
["ScriptExtensions.txt"] = "049117ce26b9769fe2749b06eef51a50a89faef4a97764dd2d81daa715980700", // DevSkim: ignore DS173237
["DerivedNormalizationProps.txt"] = "4d4c03892dea9146d674b686e495df2d55a28d071ac474041d73518f887abddc" // DevSkim: ignore DS173237
};
foreach (var input in inputs)
{
var path = Path.Combine(inputDirectory, input.Key);
if (!File.Exists(path))
{
throw new FileNotFoundException($"Missing Unicode 16 input '{input.Key}'.", path);
}
var actual = Convert.ToHexString(SHA256.HashData(File.ReadAllBytes(path))).ToLowerInvariant();
if (actual != input.Value)
{
throw new InvalidOperationException(
$"Unicode 16 input '{input.Key}' has SHA-256 {actual}; expected {input.Value}.");
}
}
var unicodeDataPath = Path.Combine(inputDirectory, "UnicodeData.txt");
var categories = new string?[scalarCount];
var uppercaseMappings = new Dictionary<int, int>();
var lowercaseMappings = new Dictionary<int, int>();
ReadUnicodeData(
unicodeDataPath,
categories,
uppercaseMappings,
lowercaseMappings);
var unicodeDataFile = Path.Combine(
repositoryRoot,
"src",
"Humanizer",View on GitHub (pinned to ffc2b77c0f)
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.
Example fix
# before: stale files cause hash mismatch # after: re-download from the Unicode 16 release sha256sum ./ucd/UnicodeData.txt # compare with expected hash from Program.cs, re-download if mismatch wget https://www.unicode.org/Public/16.0.0/ucd/UnicodeData.txt -O ./ucd/UnicodeData.txt
Defensive patterns
Strategy: validation
Validate before calling
static bool VerifyUcdHash(string path, string expectedSha256)
{
var actual = Convert.ToHexString(
SHA256.HashData(File.ReadAllBytes(path))).ToLowerInvariant();
return actual == expectedSha256;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Contributor downloads the wrong Unicode version. Files cached from a previous Unicode release. Truncated download. Git or transfer corruption altering bytes.
Related errors
- Missing Unicode 16 input '{input.Key}'.
- Generated Unicode 16 inflection data is stale. Run the gener
- Could not find the Humanizer repository root from '{start}'.
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/f4ff4ec7f03179ec.
Report an issue: GitHub.