{"record":{"id":"bd379d18db3369cc","repo":"dotnet/runtime","slug":"failed-to-load-icu-data","errorCode":null,"errorMessage":"Failed to load ICU data","messagePattern":"Failed to load ICU data","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/mono/browser/runtime/icu.ts","lineNumber":9,"sourceCode":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n\nimport cwraps from \"./cwraps\";\nimport { VoidPtr } from \"./types/emscripten\";\n\nexport function wasm_load_icu_data (offset: VoidPtr) {\n    if (!cwraps.wasm_load_icu_data(offset)) {\n        throw new Error(\"Failed to load ICU data\");\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":12,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/mono/browser/runtime/icu.ts#L1-L12","documentation":"Thrown by wasm_load_icu_data in icu.ts when the native cwrap function cwraps.wasm_load_icu_data(offset) returns a falsy value. That native call loads an ICU data blob (already downloaded into wasm memory) into the runtime; a zero/false return means the native loader rejected the data (bad magic, truncated blob, version mismatch) or ran out of memory. This is the runtime's hard failure for corrupt ICU data.","triggerScenarios":"Shipping a truncated or corrupted ICU .dat file; mixing an ICU archive built for a different ICU version than the wasm runtime; a download that was cut short (proxy, cache) so the bytes passed in are incomplete; out of wasm memory.","commonSituations":"Custom build pipeline that re-compresses ICU data incorrectly; CDN/cache serving a stale partial ICU file; misconfigured globalizationMode producing the wrong ICU asset name.","solutions":["Re-download the ICU data archive from a known-good source and verify its size/checksum.","Ensure the ICU archive version matches the .NET wasm runtime build (use the archive shipped with that runtime).","If memory-bound, increase the wasm maximum heap size.","As a workaround, enable invariant globalization (DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1) if locale-aware APIs are not needed."],"exampleFix":"// before: corrupt or partial icudt.dat\nconfig.resources.icu = [{ name: 'icudt.dat' }];\n// after: verify asset integrity at build time\n// (md5/sha check) or fall back to invariant\nconfig.environmentVariables['DOTNET_SYSTEM_GLOBALIZATION_INVARIANT'] = '1';","handlingStrategy":"validation","validationCode":"// verify ICU archive integrity at build/deploy time\nconst expectedHash = '<known sha256>';\nconst buf = await fs.promises.readFile('icudt.dat');\nif (sha256(buf) !== expectedHash) throw new Error('ICU archive corrupt');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ship ICU archives from the matching runtime build.","Verify ICU file sizes/hashes in your deployment script.","Keep an invariant fallback (DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1) for environments where ICU cannot be guaranteed."],"tags":["icu","globalization","native","corruption","startup"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}