facebook/docusaurus · error · Error
Localized value for config key=${key} not found for both cur
Error message
Localized value for config key=${key} not found for both currentLocale=${currentLocale} or defaultLocale=${defaultLocale} What it means
Thrown by getLocalizedConfigValue() when the key DOES exist in ConfigLocalized but the value object has neither an entry for the current locale (DOCUSAURUS_CURRENT_LOCALE) nor for the default locale ('en'). The fallback chain is `values[currentLocale] ?? values[defaultLocale]`; if both are falsy, the build aborts. The message reports both the current and default locale so you know exactly which translations are missing.
Source
Thrown at website/docusaurus.config.ts:159
const isRsdoctor = process.env.RSDOCTOR === 'true';
/*
const TwitterSvg =
'<svg style="fill: #1DA1F2; vertical-align: middle; margin-left: 3px;" width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path></svg>';
*/
const defaultLocale = 'en';
function getLocalizedConfigValue(key: keyof typeof ConfigLocalized) {
const currentLocale = process.env.DOCUSAURUS_CURRENT_LOCALE ?? defaultLocale;
const values = ConfigLocalized[key];
if (!values) {
throw new Error(`Localized config key=${key} not found`);
}
const value = values[currentLocale] ?? values[defaultLocale];
if (!value) {
throw new Error(
`Localized value for config key=${key} not found for both currentLocale=${currentLocale} or defaultLocale=${defaultLocale}`,
);
}
return value;
}
// By default, we don't want to run "git log" commands on i18n sites
// This makes localized sites build much slower on Netlify
// See also https://github.com/facebook/docusaurus/issues/11208
// const showLastUpdate = process.env.DOCUSAURUS_CURRENT_LOCALE === defaultLocale;
const showLastUpdate = true;
export default async function createConfigAsync() {
return {
title: 'Docusaurus',
tagline: getLocalizedConfigValue('tagline'),
organizationName: 'facebook',
projectName: 'docusaurus',View on GitHub (pinned to 3f483e80e3)
Solutions
- Ensure ConfigLocalized[key] has at least an 'en' value — the default-locale fallback guarantees any locale build works.
- If building a specific locale, add that locale's value too for a complete translation.
- Replace empty-string values with real content, since the truthiness guard treats '' as missing.
- Verify DOCUSAURUS_CURRENT_LOCALE matches a locale code you actually populated.
Example fix
// before
const ConfigLocalized = {
tagline: { de: 'Baustatische...' }, // no en, no current locale
};
// after
const ConfigLocalized = {
tagline: { en: 'Build optimized sites...', de: '...', fr: '...' },
}; Defensive patterns
Strategy: validation
Validate before calling
const DEFAULT_LOCALE = 'en';
function assertLocalizedValue(
map: Record<string, Record<string, string>>,
key: string,
currentLocale: string,
) {
const values = map[key];
const value = values?.[currentLocale] ?? values?.[DEFAULT_LOCALE];
if (!value) {
throw new Error(
`Missing localized value for '${key}': need either '${currentLocale}' or '${DEFAULT_LOCALE}'.`,
);
}
}
// pre-build: for (const key of Object.keys(ConfigLocalized))
// assertLocalizedValue(ConfigLocalized, key, process.env.DOCUSAURUS_CURRENT_LOCALE ?? 'en'); Type guard
const hasLocalizedValue = ( values: Record<string, string> | undefined, locale: string, fallback = 'en', ): boolean => Boolean(values?.[locale] ?? values?.[fallback]);
Prevention
- Always populate the default 'en' entry when adding a localized key — it is the universal fallback.
- Disallow empty-string localized values in CI (treat '' as missing).
- Run the localized build for each locale in CI to catch missing translations early.
When it happens
Trigger: Building a localized site with DOCUSAURUS_CURRENT_LOCALE=fr where a ConfigLocalized key only has, say, a `de` entry and no `en` or `fr`; someone added a localized key but only filled in a non-default, non-target locale; an entry whose 'en' value was set to an empty string (falsy) which also fails the `if (!value)` guard.
Common situations: Adding a new locale for a deploy preview before all config keys are translated; a translator filled in `fr` but the default `en` entry was deleted; empty-string values silently treated as missing because the guard uses truthiness rather than key presence.
Related errors
- Localized config key=${key} not found
- No tags file '${relativeFilePath}' could be found in any of
- Can't find locale config for locale ${logger.code(localeToLo
- Can't write-translation for locale "${locale}" that is not i
- Docusaurus couldn't infer a default locale config for ${loca
AI-assisted analysis of facebook/docusaurus@3f483e80e3 (2026-08-12).
Data as JSON: /api/errors/d22bef4119d95db6.
Report an issue: GitHub.