{"record":{"id":"f1bdcfcbc8f766de","repo":"dotnet/runtime","slug":"invariant-globalization-mode-is-inactive-and-no-ic","errorCode":null,"errorMessage":"invariant globalization mode is inactive and no ICU data archives are available","messagePattern":"invariant globalization mode is inactive and no ICU data archives are available","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"src/mono/browser/runtime/loader/icu.ts","lineNumber":23,"sourceCode":"import { GlobalizationMode, MonoConfig } from \"../types\";\nimport { ENVIRONMENT_IS_WEB, loaderHelpers } from \"./globals\";\nimport { mono_log_info, mono_log_debug } from \"./logging\";\n\nexport function init_globalization () {\n    loaderHelpers.preferredIcuAsset = getIcuResourceName(loaderHelpers.config);\n    let invariantMode = loaderHelpers.config.globalizationMode == GlobalizationMode.Invariant;\n\n    if (!invariantMode) {\n        if (loaderHelpers.preferredIcuAsset) {\n            mono_log_debug(\"ICU data archive(s) available, disabling invariant mode\");\n        } else if (loaderHelpers.config.globalizationMode !== GlobalizationMode.Custom && loaderHelpers.config.globalizationMode !== GlobalizationMode.All && loaderHelpers.config.globalizationMode !== GlobalizationMode.Sharded) {\n            mono_log_debug(\"ICU data archive(s) not available, using invariant globalization mode\");\n            invariantMode = true;\n            loaderHelpers.preferredIcuAsset = null;\n        } else {\n            const msg = \"invariant globalization mode is inactive and no ICU data archives are available\";\n            mono_log_error(`ERROR: ${msg}`);\n            throw new Error(msg);\n        }\n    }\n\n    const invariantEnv = \"DOTNET_SYSTEM_GLOBALIZATION_INVARIANT\";\n    const env_variables = loaderHelpers.config.environmentVariables!;\n    if (env_variables[invariantEnv] === undefined && invariantMode) {\n        env_variables[invariantEnv] = \"1\";\n    }\n    if (env_variables[\"TZ\"] === undefined) {\n        try {\n            // this call is relatively expensive, so we call it during download of other assets\n            const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone || null;\n            if (timezone) {\n                env_variables![\"TZ\"] = timezone;\n            }\n        } catch {\n            mono_log_info(\"failed to detect timezone, will fallback to UTC\");\n        }","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/mono/browser/runtime/loader/icu.ts#L5-L41","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: Sharded requested, no ICU shipped\nconfig.globalizationMode = 'Sharded';\n// after: ship the shards or go invariant\nconfig.resources.icu = [{ name:'icudt_EFIGS.dat', virtualPath:'icudt_EFIGS.dat' }];","handlingStrategy":"validation","validationCode":"// before starting the runtime\nconst needsIcu = ['Custom','All','Sharded'].includes(config.globalizationMode);\nif (needsIcu && !(config.resources?.icu?.length))\n    throw new Error(`${config.globalizationMode} mode requires ICU data`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["icu","globalization","configuration","startup"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}