{"record":{"id":"aa262b3da7bae191","repo":"jestjs/jest","slug":"multiple-configurations-found-configpa","errorCode":null,"errorMessage":"● Multiple configurations found:\n\n    * ${configPath}\n    ...\n  Implicit config resolution does not allow multiple configuration files.\n  Either remove unused config files or select one explicitly with `--config`.","messagePattern":"● Multiple configurations found:\n\n    \\* (.+?)\n    \\.\\.\\.\n  Implicit config resolution does not allow multiple configuration files\\.\n  Either remove unused config files or select one explicitly with `--config`\\.","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"packages/jest-config/src/resolveConfigPath.ts","lineNumber":108,"sourceCode":"            `${BULLET}Validation Error`,\n            `  Configuration in ${chalk.bold(packageJson)} is not valid. ` +\n              `Jest expects the string configuration to point to a file, but ${absolutePath} is not. ` +\n              `Please check your Jest configuration in ${chalk.bold(\n                packageJson,\n              )}.`,\n            DOCUMENTATION_NOTE,\n          );\n        }\n\n        configFiles.push(absolutePath);\n      } else {\n        configFiles.push(packageJson);\n      }\n    }\n  }\n\n  if (!skipMultipleConfigError && configFiles.length > 1) {\n    throw new ValidationError(...makeMultipleConfigsErrorMessage(configFiles));\n  }\n\n  if (configFiles.length > 0 || packageJson) {\n    return configFiles[0] ?? packageJson;\n  }\n\n  // This is the system root.\n  // We tried everything, config is nowhere to be found ¯\\_(ツ)_/¯\n  if (pathToResolve === path.dirname(pathToResolve)) {\n    throw new Error(makeResolutionErrorMessage(initialPath, cwd));\n  }\n\n  // go up a level and try it again\n  return resolveConfigPathByTraversing(\n    path.dirname(pathToResolve),\n    initialPath,\n    cwd,\n    skipMultipleConfigError,","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/jestjs/jest/blob/8e6d128e4a278059ecddecaa97400b04c8ae5fd9/packages/jest-config/src/resolveConfigPath.ts#L90-L126","documentation":"Thrown as a ValidationError during directory traversal when more than one Jest config file is discovered (across jest.config.{js,ts,...} extensions or the package.json 'jest' key) and the caller did not pass skipMultipleConfigError. Jest refuses to guess which config to use under implicit resolution.","triggerScenarios":"Having both jest.config.js and jest.config.ts in the same directory; a jest.config.* file plus a 'jest' key in package.json; leftover configs after migrating between formats (e.g. .js -> .ts without deleting the old one).","commonSituations":"Migrations between config formats; monorepo scaffolding that drops multiple templates; tooling (Nx, Angular) that generates a second config; merging projects that each brought their own config.","solutions":["Delete the unused config file(s), keeping only one","Or pass --config <path> to explicitly select the config you want","Remove the 'jest' key from package.json if a dedicated config file exists"],"exampleFix":"# before: both jest.config.js and jest.config.ts present\n\n# after option A: remove one\nrm jest.config.js\n\n# after option B: select explicitly\njest --config jest.config.ts","handlingStrategy":"validation","validationCode":"import * as fs from 'node:fs';\nimport * as path from 'node:path';\nconst JEST_CONFIG_EXT_ORDER = ['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs', '.json'];\nfunction findDuplicateConfigs(dir: string): string[] {\n  return JEST_CONFIG_EXT_ORDER\n    .map(ext => path.join(dir, `jest.config${ext}`))\n    .filter(f => fs.existsSync(f));\n}\nconst dups = findDuplicateConfigs(process.cwd());\nif (dups.length > 1) {\n  throw new Error(`Multiple Jest configs found: ${dups.join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Delete old config files when migrating formats (e.g. .js -> .ts)","Don't keep a 'jest' key in package.json alongside a jest.config.* file","Add a CI check that fails if more than one config is present"],"tags":["config","discovery","validation","multi-config"],"backgroundTag":null,"analyzedSha":"8e6d128e4a278059ecddecaa97400b04c8ae5fd9","analyzedAt":"2026-08-10T18:11:27.960Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}