facebook/docusaurus · error
Can't get component config: component doesn't exist: ${compo
Error message
Can't get component config: component doesn't exist: ${component} What it means
Thrown by `getThemeComponents().getConfig(component)` when the requested component name is not present in the union of files actually found in the theme plus computed intermediate folder names. The swizzle machinery refuses to look up config for a component it cannot see on disk.
Source
Thrown at packages/docusaurus/src/commands/swizzle/components.ts:173
// because it has not any index component
wrap: 'forbidden',
eject: FallbackSwizzleActionStatus,
},
description: FallbackSwizzleComponentDescription,
};
const allInitialComponents = await readComponentNames(themePath);
const missingIntermediateComponentFolderNames =
getMissingIntermediateComponentFolderNames(allInitialComponents);
const allComponents = sortComponentNames(
allInitialComponents.concat(missingIntermediateComponentFolderNames),
);
function getConfig(component: string): SwizzleComponentConfig {
if (!allComponents.includes(component)) {
throw new Error(
`Can't get component config: component doesn't exist: ${component}`,
);
}
const config = swizzleConfig.components[component];
if (config) {
return config;
}
const isIntermediateFolder =
missingIntermediateComponentFolderNames.includes(component);
if (isIntermediateFolder) {
return FallbackIntermediateFolderSwizzleComponentConfig;
}
return (
swizzleConfig.components[component] ?? FallbackSwizzleComponentConfig
);
}
function getDescription(component: string): string {View on GitHub (pinned to 3f483e80e3)
Solutions
- List available components for the theme and copy the exact name: `docusaurus swizzle <theme> --list`.
- Match the casing exactly — component names are case-sensitive paths.
- Upgrade or downgrade the theme to the version whose component list matches the name you are using.
- Verify you are swizzling the right theme (the component may live in a different installed theme).
Example fix
# before docusaurus swizzle @docusaurus/theme-classic Searchbar # typo # after docusaurus swizzle @docusaurus/theme-classic SearchBar
Defensive patterns
Strategy: validation
Validate before calling
const all = await readComponentNames(themePath);
if (!all.includes(component)) {
throw new Error(`Unknown component ${component}. Run swizzle --list.`);
} Type guard
function isKnownComponent(name: string, known: string[]): name is string {
return known.includes(name);
} Try / catch
try { await swizzle(theme, component); }
catch (e) {
if (/component doesn't exist/.test(e.message)) {
console.error(`Run: docusaurus swizzle ${theme} --list`); process.exit(1);
}
throw e;
} Prevention
- Always copy the exact component name from `swizzle --list` output.
- Treat component names as case-sensitive.
- Re-list after upgrading a theme, since names can change.
When it happens
Trigger: Calling `docusaurus swizzle <theme> <component>` (or the internal `getConfig`) where `<component>` is not in the theme's discovered component list — typo, wrong theme, or a component that only exists in a different version.
Common situations: Misspelling a component (e.g. `SearchBar` vs `Searchbar`); copy-pasting a component name from an outdated tutorial; targeting a component that was renamed/removed in the installed theme version; using a component path that belongs to a different theme.
Related errors
- Swizzle config does not match expected schema: ${result.erro
- Theme ${themeName} not found
- No files to copy from path=${fromPath} with glob code=${glob
- Theme name=${plugin.instance.name} does not support the code
- Invalid command: ${command}
AI-assisted analysis of facebook/docusaurus@3f483e80e3 (2026-08-12).
Data as JSON: /api/errors/168be09f0f5cfd1e.
Report an issue: GitHub.