{"record":{"id":"8a89a788dc37168a","repo":"facebook/docusaurus","slug":"docusaurus-bug-no-locale-config-found-for-locale","errorCode":null,"errorMessage":"Docusaurus bug, no locale config found for locale=${locale}","messagePattern":"Docusaurus bug, no locale config found for locale=(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-theme-classic/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx","lineNumber":32,"sourceCode":"import IconLanguage from '@theme/Icon/Language';\nimport type {LinkLikeNavbarItemProps} from '@theme/NavbarItem';\nimport type {Props} from '@theme/NavbarItem/LocaleDropdownNavbarItem';\n\nimport styles from './styles.module.css';\n\nfunction useLocaleDropdownUtils() {\n  const {\n    siteConfig,\n    i18n: {localeConfigs},\n  } = useDocusaurusContext();\n  const alternatePageUtils = useAlternatePageUtils();\n  const search = useHistorySelector((history) => history.location.search);\n  const hash = useHistorySelector((history) => history.location.hash);\n\n  const getLocaleConfig = (locale: string) => {\n    const localeConfig = localeConfigs[locale];\n    if (!localeConfig) {\n      throw new Error(\n        `Docusaurus bug, no locale config found for locale=${locale}`,\n      );\n    }\n    return localeConfig;\n  };\n\n  const getBaseURLForLocale = (locale: string) => {\n    const localeConfig = getLocaleConfig(locale);\n    const isSameDomain = localeConfig.url === siteConfig.url;\n    if (isSameDomain) {\n      // Shorter paths if localized sites are hosted on the same domain\n      // This reduces HTML size a bit\n      return `pathname://${alternatePageUtils.createUrl({\n        locale,\n        fullyQualified: false,\n      })}`;\n    }\n    return alternatePageUtils.createUrl({","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-theme-classic/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx#L14-L50","documentation":"Thrown by `LocaleDropdownNavbarItem` when `localeConfigs[locale]` is undefined for a requested locale. The message self-describes as a 'Docusaurus bug', signaling the team's intent that this should never happen for a properly-configured i18n setup — every locale in `i18n.locales` should have a corresponding config entry.","triggerScenarios":"The current route's locale (or a locale computed for the dropdown) is not present in `siteConfig.i18n.localeConfigs`. This can happen if the i18n config was altered, a locale was removed while routes still reference it, or an internal invariant between `i18n.locales` and `localeConfigs` was violated.","commonSituations":"Editing `i18n` config to drop a locale without clearing the build cache / generated routes; a deploy of a partially-synced config; a swizzled dropdown that synthesizes a locale string not declared in config; locale URL pathname parsing yielding an unexpected value.","solutions":["Confirm every locale in `i18n.locales` resolves to an entry (Docusaurus auto-fills `localeConfigs`, so ensure no locale was orphaned).","Run `docusaurus clear` and rebuild so stale route/locale metadata is regenerated.","If you swizzled the dropdown, only iterate locales from `i18n.locales`, not from arbitrary URL parsing.","Report upstream if config is consistent and the invariant still breaks (the message explicitly invites a bug report)."],"exampleFix":"// before\ni18n: { defaultLocale: 'en', locales: ['en', 'fr'], localeConfigs: { en: {...} } }\n// fr has no config entry (should be auto-generated, but cache may be stale)\n// after\ni18n: { defaultLocale: 'en', locales: ['en', 'fr'], localeConfigs: { en: {...}, fr: {...} } }\n// then run: docusaurus clear && docusaurus build","handlingStrategy":"validation","validationCode":"const {i18n} = useDocusaurusContext();\nfunction localeIsConfigured(locale: string): boolean {\n  return Object.prototype.hasOwnProperty.call(i18n.localeConfigs, locale);\n}","typeGuard":"function isConfiguredLocale(locale: string, localeConfigs: Record<string, unknown>): locale is string {\n  return locale in localeConfigs;\n}","tryCatchPattern":null,"preventionTips":["Keep `i18n.locales` and `localeConfigs` in sync.","Run `docusaurus clear` after editing i18n config.","Iterate dropdown locales from `i18n.locales`, not URL parsing."],"tags":["i18n","navbar","config","theme-classic"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}