dotnet/runtime · critical · Error
invariant globalization mode is inactive and no ICU data…
Error message
invariant globalization mode is inactive and no ICU data archives are available
What it means
Thrown by init_globalization in loader/icu.ts when globalizationMode is set to Custom, All, or Sharded but getIcuResourceName returned no preferred ICU asset (no ICU files present in resources.icu). The user explicitly requested a non-invariant, non-shipped-fallback ICU mode but provided no ICU data, so the loader cannot proceed. Invariant mode would be the fallback, but the explicit mode forbids it.
Solutions
- Ship the matching ICU archive(s): full (icudt.dat) for All, the EFIGS/CJK/no_CJK shard for Sharded, or your custom archive for Custom.
- If you do not need locale-aware globalization, set globalizationMode = Invariant (or omit the config and let the loader fall back).
- Verify the resources.icu array is populated and the asset names resolve.
Example fix
// before: Sharded requested, no ICU shipped
config.globalizationMode = 'Sharded';
// after: ship the shards or go invariant
config.resources.icu = [{ name:'icudt_EFIGS.dat', virtualPath:'icudt_EFIGS.dat' }]; Defensive patterns
Strategy: validation
Validate before calling
// before starting the runtime
const needsIcu = ['Custom','All','Sharded'].includes(config.globalizationMode);
if (needsIcu && !(config.resources?.icu?.length))
throw new Error(`${config.globalizationMode} mode requires ICU data`); Prevention
- When setting globalizationMode to Custom/All/Sharded, ship the matching ICU archive(s).
- Use Invariant mode if you cannot guarantee ICU data availability.
- Verify resources.icu is populated at build time.
When it happens
Trigger: Setting config.globalizationMode = GlobalizationMode.Sharded (or All/Custom) without including any ICU .dat files in resources; misconfigured build that strips ICU data but requests a real ICU mode; a custom ICU archive path that does not resolve.
Common situations: Trying to reduce download size by sharding ICU but the shards are not published in the output; setting GlobalizationMode.Custom without providing the custom ICU asset; upgrading the SDK changed default behavior.
Related errors
- Failed to load ICU data
- Can't use moduleFactory callback of createDotnetRuntime…
- Failed to initialize ICU data
- Invalid config, resources is not set
- Loader configuration error: 'mainAssemblyName' is required.
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/f1bdcfcbc8f766de.
Report an issue: GitHub.
Appendix: source
Thrown at src/mono/browser/runtime/loader/icu.ts:23
import { GlobalizationMode, MonoConfig } from "../types";
import { ENVIRONMENT_IS_WEB, loaderHelpers } from "./globals";
import { mono_log_info, mono_log_debug } from "./logging";
export function init_globalization () {
loaderHelpers.preferredIcuAsset = getIcuResourceName(loaderHelpers.config);
let invariantMode = loaderHelpers.config.globalizationMode == GlobalizationMode.Invariant;
if (!invariantMode) {
if (loaderHelpers.preferredIcuAsset) {
mono_log_debug("ICU data archive(s) available, disabling invariant mode");
} else if (loaderHelpers.config.globalizationMode !== GlobalizationMode.Custom && loaderHelpers.config.globalizationMode !== GlobalizationMode.All && loaderHelpers.config.globalizationMode !== GlobalizationMode.Sharded) {
mono_log_debug("ICU data archive(s) not available, using invariant globalization mode");
invariantMode = true;
loaderHelpers.preferredIcuAsset = null;
} else {
const msg = "invariant globalization mode is inactive and no ICU data archives are available";
mono_log_error(`ERROR: ${msg}`);
throw new Error(msg);
}
}
const invariantEnv = "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT";
const env_variables = loaderHelpers.config.environmentVariables!;
if (env_variables[invariantEnv] === undefined && invariantMode) {
env_variables[invariantEnv] = "1";
}
if (env_variables["TZ"] === undefined) {
try {
// this call is relatively expensive, so we call it during download of other assets
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone || null;
if (timezone) {
env_variables!["TZ"] = timezone;
}
} catch {
mono_log_info("failed to detect timezone, will fallback to UTC");
}View on GitHub (pinned to 60108ba66e)