dotnet/runtime · critical · Error

Failed to load ICU data

Error message

Failed to load ICU data

What it means

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.

Solutions

  1. Re-download the ICU data archive from a known-good source and verify its size/checksum.
  2. Ensure the ICU archive version matches the .NET wasm runtime build (use the archive shipped with that runtime).
  3. If memory-bound, increase the wasm maximum heap size.
  4. As a workaround, enable invariant globalization (DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1) if locale-aware APIs are not needed.

Example fix

// before: corrupt or partial icudt.dat
config.resources.icu = [{ name: 'icudt.dat' }];
// after: verify asset integrity at build time
// (md5/sha check) or fall back to invariant
config.environmentVariables['DOTNET_SYSTEM_GLOBALIZATION_INVARIANT'] = '1';
Defensive patterns

Strategy: validation

Validate before calling

// verify ICU archive integrity at build/deploy time
const expectedHash = '<known sha256>';
const buf = await fs.promises.readFile('icudt.dat');
if (sha256(buf) !== expectedHash) throw new Error('ICU archive corrupt');

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/bd379d18db3369cc. Report an issue: GitHub.

Appendix: source

Thrown at src/mono/browser/runtime/icu.ts:9

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

import cwraps from "./cwraps";
import { VoidPtr } from "./types/emscripten";

export function wasm_load_icu_data (offset: VoidPtr) {
    if (!cwraps.wasm_load_icu_data(offset)) {
        throw new Error("Failed to load ICU data");
    }
}

View on GitHub (pinned to 60108ba66e)