facebook/docusaurus · error · Error

Localized config key=${key} not found

Error message

Localized config key=${key} not found

What it means

Thrown by getLocalizedConfigValue() in the Docusaurus website's own docusaurus.config.ts when the requested key does not exist in the ConfigLocalized map at all (the lookup returns undefined before locale resolution even starts). This is an authoring mistake in the website's localized config: the caller asked for a key that was never declared. The default locale is 'en' and the current locale comes from DOCUSAURUS_CURRENT_LOCALE.

Source

Thrown at website/docusaurus.config.ts:155

// https://docusaurus-i18n-staging.netlify.app/
const isI18nStaging = process.env.I18N_STAGING === 'true';

const isVersioningDisabled = !!process.env.DISABLE_VERSIONING || isI18nStaging;

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 {

View on GitHub (pinned to 3f483e80e3)

Solutions

  1. Open the ConfigLocalized declaration and confirm the key exists; if missing, add an object with at least an 'en' value.
  2. Check for a typo in the key argument at the call site versus the ConfigLocalized key (exact string match required).
  3. If you intentionally removed the key, also remove the getLocalizedConfigValue('<key>') call site that still references it.
  4. Rebuild after fixing — this throws at config-eval time, so the build won't proceed until resolved.

Example fix

// before
const ConfigLocalized = { tagline: { en: '...', fr: '...' } };
getLocalizedConfigValue('announcement'); // key missing
// after
const ConfigLocalized = {
  tagline: { en: '...', fr: '...' },
  announcement: { en: 'New release!', fr: 'Nouvelle version !' },
};
Defensive patterns

Strategy: type-guard

Validate before calling

import {ConfigLocalized} from './localizedConfig'; // your map

function assertLocalizedKey(key: string): asserts key is keyof typeof ConfigLocalized {
  if (!(key in ConfigLocalized)) {
    throw new Error(`ConfigLocalized is missing key '${key}' — add it with at least { en: '...' }.`);
  }
}

// assertLocalizedKey('announcement'); getLocalizedConfigValue('announcement');

Type guard

const isLocalizedKey = (k: string): k is keyof typeof ConfigLocalized =>
  k in ConfigLocalized;

Prevention

When it happens

Trigger: A new getLocalizedConfigValue('someKey') call site is added but the matching entry is not added to ConfigLocalized; the key string is misspelled or renamed in one place but not the other; a refactor removes an entry from ConfigLocalized but leaves a caller behind.

Common situations: Editing the Docusaurus website config to add a new localized field (tagline, announcement) and forgetting the ConfigLocalized entry; merge conflicts that drop a ConfigLocalized entry while keeping its consumer.

Related errors


AI-assisted analysis of facebook/docusaurus@3f483e80e3 (2026-08-12). Data as JSON: /api/errors/26700e5441c03974. Report an issue: GitHub.