gatsbyjs/gatsby · error

10125

10125

Error message

Your ${context.configName} file is in the wrong place. You've placed it in the src/ directory. It must instead be at the root of your site next to your package.json file.

What it means

Error "Your ${context.configName} file is in the wrong place. You've placed it in the src/ directory. It must instead be at the root of your site next to your package.json file." thrown in gatsbyjs/gatsby.

Source

Thrown at packages/gatsby/src/bootstrap/get-config-file.ts:157

      id: `10124`,
      error,
      context: {
        configName,
        nearMatch,
        isTSX,
      },
    })
  }

  // gatsby-config is incorrectly located in src directory
  const isInSrcDir = await resolveJSFilepath({
    rootDir: siteDirectory,
    filePath: path.join(siteDirectory, `src`, configName),
    warn: false,
  })

  if (isInSrcDir) {
    report.panic({
      id: `10125`,
      context: {
        configName,
      },
    })
  }

  return uncompiledResult
}

async function checkTsAndNearMatch(
  siteDirectory: string,
  configName: string,
  distance: number
): Promise<{
  tsConfig: boolean
  nearMatch: string
}> {

View on GitHub (pinned to e85d62f177)

Solutions

  1. Move the config file out of src/ to the site root, next to package.json
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/gatsby/src/bootstrap/get-config-file.ts:157 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/2cde4b2397a32cac. Report an issue: GitHub.