{"record":{"id":"90453f8cd8f0b2c2","repo":"facebook/docusaurus","slug":"no-config-file-found-in-site-dir-code-relativesi","errorCode":null,"errorMessage":"No config file found in site dir code=${relativeSiteDir}.\\nExpected one of:${candidates.map(logger.code)}\\nYou can provide a custom config path with the code=${'--config'} option.","messagePattern":"No config file found in site dir code=(.+?)\\.\\\\nExpected one of:(.+?)\\\\nYou can provide a custom config path with the code=(.+?) option\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/server/config.ts","lineNumber":30,"sourceCode":"  DEFAULT_CONFIG_FILE_NAME,\n  findAsyncSequential,\n  loadFreshModule,\n} from '@docusaurus/utils';\nimport {validateConfig} from './configValidation';\nimport type {LoadContext} from '@docusaurus/types';\n\nasync function findConfig(siteDir: string) {\n  // We could support .mjs, .ts, etc. in the future\n  const candidates = ['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs'].map(\n    (ext) => DEFAULT_CONFIG_FILE_NAME + ext,\n  );\n  const configPath = await findAsyncSequential(\n    candidates.map((file) => path.join(siteDir, file)),\n    fs.pathExists,\n  );\n  if (!configPath) {\n    const relativeSiteDir = path.relative(process.cwd(), siteDir);\n    throw new Error(logger.interpolate`No config file found in site dir code=${relativeSiteDir}.\nExpected one of:${candidates.map(logger.code)}\nYou can provide a custom config path with the code=${'--config'} option.\n    `);\n  }\n  return configPath;\n}\n\nexport async function loadSiteConfig({\n  siteDir,\n  customConfigFilePath,\n}: {\n  siteDir: string;\n  customConfigFilePath?: string;\n}): Promise<Pick<LoadContext, 'siteConfig' | 'siteConfigPath'>> {\n  const siteConfigPath = customConfigFilePath\n    ? path.resolve(siteDir, customConfigFilePath)\n    : await findConfig(siteDir);\n","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/server/config.ts#L12-L48","documentation":"Thrown by `findConfig(siteDir)` when none of the supported config file names (`docusaurus.config.{ts,mts,cts,js,mjs,cjs}`) exist in the site directory. Docusaurus auto-discovers a config by extension; if none is present and no `--config` was supplied, it cannot load site config.","triggerScenarios":"Running any Docusaurus CLI command from a directory that contains no `docusaurus.config.*` file (e.g. wrong cwd, fresh repo before creating config, config renamed to something non-standard).","commonSituations":"Running `docusaurus start` from the monorepo root instead of `website/`; renamed config to `config.js`; brand-new project where the config has not been created yet; cloned a repo whose config lives in a subfolder.","solutions":["Change into the directory that contains your `docusaurus.config.{js,ts,...}` and re-run the command.","Create a config file using one of the supported extensions if you do not have one yet (`create-docusaurus` can scaffold it).","Point at the config explicitly: `docusaurus start --config path/to/docusaurus.config.js`.","Restore the config file if it was accidentally deleted/renamed."],"exampleFix":"# before: wrong directory\ndocusaurus start  # throws from repo root\n# after\ncd website\ndocusaurus start\n# or\ndocusaurus start --config website/docusaurus.config.js","handlingStrategy":"validation","validationCode":"import fs from 'fs-extra';\nconst exts = ['.ts','.mts','.cts','.js','.mjs','.cjs'];\nconst found = await findAsyncSequential(exts.map(e => path.join(siteDir, 'docusaurus.config'+e)), fs.pathExists);\nif (!found) throw new Error('No docusaurus.config.* in siteDir');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run Docusaurus commands from the site directory.","Pass `--config` explicitly when cwd is ambiguous.","Name the config `docusaurus.config.{js,ts,...}`."],"tags":["config","cli","filesystem"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}