jestjs/jest · error · ValidationError

Multiple configurations found Implicit config resolution d

Error message

Multiple configurations found
  Implicit config resolution does not allow multiple configuration files.
  Either remove unused config files or select one explicitly with `--config`.

What it means

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.

Source

Thrown at packages/jest-config/src/resolveConfigPath.ts:108

            `${BULLET}Validation Error`,
            `  Configuration in ${chalk.bold(packageJson)} is not valid. ` +
              `Jest expects the string configuration to point to a file, but ${absolutePath} is not. ` +
              `Please check your Jest configuration in ${chalk.bold(
                packageJson,
              )}.`,
            DOCUMENTATION_NOTE,
          );
        }

        configFiles.push(absolutePath);
      } else {
        configFiles.push(packageJson);
      }
    }
  }

  if (!skipMultipleConfigError && configFiles.length > 1) {
    throw new ValidationError(...makeMultipleConfigsErrorMessage(configFiles));
  }

  if (configFiles.length > 0 || packageJson) {
    return configFiles[0] ?? packageJson;
  }

  // This is the system root.
  // We tried everything, config is nowhere to be found ¯\_(ツ)_/¯
  if (pathToResolve === path.dirname(pathToResolve)) {
    throw new Error(makeResolutionErrorMessage(initialPath, cwd));
  }

  // go up a level and try it again
  return resolveConfigPathByTraversing(
    path.dirname(pathToResolve),
    initialPath,
    cwd,
    skipMultipleConfigError,

View on GitHub (pinned to f49721c78e)

Solutions

  1. Delete the unused config file(s) so only one remains
  2. Select one explicitly with --config <path>
  3. If you intentionally need multiple, call readConfigs with skipMultipleConfigError=true (programmatic only)

Example fix

# before: both jest.config.js and jest.config.ts present
rm jest.config.js
# after
jest  # now only jest.config.ts is found
Defensive patterns

Strategy: validation

Validate before calling

import {JEST_CONFIG_EXT_ORDER, JEST_CONFIG_BASE_NAME} from '@jest/config/constants';
import * as fs from 'node:fs';
import * as path from 'node:path';
const found = JEST_CONFIG_EXT_ORDER
  .map(ext => JEST_CONFIG_BASE_NAME + ext)
  .filter(f => fs.existsSync(path.resolve(dir, f)));
if (found.length > 1) {
  throw new Error(`Multiple jest configs: ${found.join(', ')}`);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jestjs/jest@f49721c78e (2026-08-03). Data as JSON: /data/errors/5795c53c36c7cdeb.json. Report an issue: GitHub.