{"id":"5795c53c36c7cdeb","repo":"jestjs/jest","slug":"multiple-configurations-found-implicit-config-re","errorCode":null,"errorMessage":"Multiple configurations found\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  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/f49721c78e195558b40913977c9230f5b7f559d8/packages/jest-config/src/resolveConfigPath.ts#L90-L126","documentation":"During directory-tree traversal, Jest collects all matching config files (jest.config.* in extension order, plus package.json with a jest key). If more than one is found and skipMultipleConfigError is false (the default for implicit resolution), it throws this ValidationError listing the duplicates, forcing an explicit choice to avoid ambiguous config selection.","triggerScenarios":"Having both jest.config.js and jest.config.ts in the same directory; a jest.config.js plus a package.json with a jest key; leftover config after migrating between formats.","commonSituations":"Migrating from .js to .ts config and forgetting to delete the old file; scaffolding a new tool that adds its own jest config; monorepo package with both a local config file and an inherited package.json key.","solutions":["Delete the unused config file(s) so only one remains","Select one explicitly with --config <path>","If you intentionally need multiple, call readConfigs with skipMultipleConfigError=true (programmatic only)"],"exampleFix":"# before: both jest.config.js and jest.config.ts present\nrm jest.config.js\n# after\njest  # now only jest.config.ts is found","handlingStrategy":"validation","validationCode":"import {JEST_CONFIG_EXT_ORDER, JEST_CONFIG_BASE_NAME} from '@jest/config/constants';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nconst found = JEST_CONFIG_EXT_ORDER\n  .map(ext => JEST_CONFIG_BASE_NAME + ext)\n  .filter(f => fs.existsSync(path.resolve(dir, f)));\nif (found.length > 1) {\n  throw new Error(`Multiple jest configs: ${found.join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep exactly one jest.config.* per package","Run a repo-wide check for stray jest config files after migrations","Use --config in CI to pin the exact file"],"tags":["config","validation","cli"],"analyzedSha":"f49721c78e195558b40913977c9230f5b7f559d8","analyzedAt":"2026-08-03T20:16:28.571Z","schemaVersion":2}