facebook/docusaurus · error · Error

Config file at "${siteConfigPath}" not found.

Error message

Config file at "${siteConfigPath}" not found.

What it means

Thrown by `loadSiteConfig` when a custom config file path was supplied (via `--config` or `customConfigFilePath`) but the resolved path does not exist on disk. Unlike error [137] (which auto-discovers), this fires only when the user explicitly named a config that is missing.

Source

Thrown at packages/docusaurus/src/server/config.ts:50

You can provide a custom config path with the code=${'--config'} option.
    `);
  }
  return configPath;
}

export async function loadSiteConfig({
  siteDir,
  customConfigFilePath,
}: {
  siteDir: string;
  customConfigFilePath?: string;
}): Promise<Pick<LoadContext, 'siteConfig' | 'siteConfigPath'>> {
  const siteConfigPath = customConfigFilePath
    ? path.resolve(siteDir, customConfigFilePath)
    : await findConfig(siteDir);

  if (!(await fs.pathExists(siteConfigPath))) {
    throw new Error(`Config file at "${siteConfigPath}" not found.`);
  }

  const importedConfig = await loadFreshModule(siteConfigPath, {default: true});

  const loadedConfig: unknown =
    typeof importedConfig === 'function'
      ? await importedConfig()
      : await importedConfig;

  const siteConfig = validateConfig(
    loadedConfig,
    path.relative(siteDir, siteConfigPath),
  );
  return {siteConfig, siteConfigPath};
}

View on GitHub (pinned to 3f483e80e3)

Solutions

  1. Check the printed resolved path — it shows exactly what Docusaurus looked for.
  2. Correct the `--config` argument to the actual file location (use an absolute path to remove ambiguity).
  3. If you intended auto-discovery, drop `--config` entirely so `findConfig` runs.
  4. Re-create or restore the config file if it should exist.

Example fix

# before
docusaurus start --config configs/docusaurus.config.js  # path wrong
# after
docusaurus start --config /abs/path/to/docusaurus.config.js
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'fs-extra';
if (customConfigFilePath && !(await fs.pathExists(path.resolve(siteDir, customConfigFilePath)))) {
  throw new Error(`Config not found: ${customConfigFilePath}`);
}

Prevention

When it happens

Trigger: Passing `--config <path>` where `<path>` resolves (relative to `siteDir`) to a non-existent file; setting a `customConfigFilePath` programmatically that points nowhere.

Common situations: Typo in the `--config` path; relative path resolved against the wrong cwd; config file moved/deleted; CI copying the wrong config path.

Related errors


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