{"record":{"id":"49c97b2c0e403d69","repo":"dotnet/runtime","slug":"locale-info-for-locale-localename-is-null-or-em","errorCode":null,"errorMessage":"Locale info for locale=${localeName} is null or empty.","messagePattern":"Locale info for locale=(.+?) is null or empty\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mono/browser/runtime/globalization-locale.ts","lineNumber":82,"sourceCode":"                        // handle non-standard or malformed locales by forwarding the locale code, e.g. \"xx-u-xx\"\n                        stringToUTF16(dst, dst + 2 * localeNameOriginal.length, localeNameOriginal);\n                        setI32(dstLength, localeNameOriginal.length);\n                        return VoidPtrNull;\n                    }\n                    throw error;\n                }\n            } else {\n                throw error;\n            }\n        }\n        const localeInfo = {\n            LanguageName: languageName,\n            RegionName: regionName,\n        };\n        const result = Object.values(localeInfo).join(OUTER_SEPARATOR);\n\n        if (!result)\n            throw new Error(`Locale info for locale=${localeName} is null or empty.`);\n\n        if (result.length > dstMaxLength)\n            throw new Error(`Locale info for locale=${localeName} exceeds length of ${dstMaxLength}.`);\n\n        stringToUTF16(dst, dst + 2 * result.length, result);\n        setI32(dstLength, result.length);\n        return VoidPtrNull;\n    } catch (ex: any) {\n        setI32(dstLength, -1);\n        return stringToUTF16Ptr(ex.toString());\n    }\n}\n","sourceCodeStart":64,"sourceCodeEnd":95,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/mono/browser/runtime/globalization-locale.ts#L64-L95","documentation":"Thrown by SystemJS_GetLocaleInfo in globalization-locale.ts when Intl.DisplayNames produced empty/undefined values for both LanguageName and RegionName, so the joined result (separated by ##) is empty. This means the ICU/display-names data could not produce any string for the requested locale. Like error 21 it is caught locally and forwarded to managed code as an error string without aborting.","triggerScenarios":"Requesting display names for a locale the loaded ICU archive does not cover (e.g. a CJK locale loaded with the EFIGS shard); invariant or minimal globalization data shipped; a locale whose region part is invalid and the fallback also returns undefined.","commonSituations":"Using sharded ICU data (icudt_EFIGS.dat) and requesting a locale outside that shard; enabling invariant mode but still querying display names; mismatched applicationCulture and shipped ICU archive.","solutions":["Ship the full ICU data archive (icudt.dat) or the shard that covers the requested locale.","Switch globalizationMode to All, or use a Custom ICU archive that covers the cultures you query.","Validate the locale against navigator.languages / a known list before requesting display names."],"exampleFix":"// before: only EFIGS shard shipped, querying ja-JP fails\n// dotnet.native.js config: resources.icu = [{ name:'icudt_EFIGS.dat' }]\n// after: ship full archive\nresources.icu = [{ name:'icudt.dat' }]","handlingStrategy":"validation","validationCode":"// validate locale coverage before requesting display names\nconst supported = Intl.DisplayNames.supportedLocalesOf([localeName], { type: 'language' });\nif (supported.length === 0) return; // ICU does not cover this locale","typeGuard":null,"tryCatchPattern":"// SystemJS_GetLocaleInfo already wraps the throw in try/catch and forwards the string.\n// On the managed side, inspect dstLength == -1 and fall back gracefully.","preventionTips":["Ship an ICU archive that covers every locale your app queries.","Use GlobalizationMode.All if you cannot predict locales at build time.","Test locale queries against the actual shipped ICU shard."],"tags":["globalization","icu","locale","displaynames"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}