microsoft/playwright · error · Error

config.updateSnapshots must be one of "all", "changed"…

Error message

config.updateSnapshots must be one of "all", "changed", "missing", "none" or "default"

What it means

A config validation error from validateConfig in the Playwright test runner's config loader: the updateSnapshots option was set to a value outside the allowed enum. Playwright only accepts the snapshot-update modes 'all', 'changed', 'missing', 'none' and 'default' (the default meaning defer to CLI flags), and any other string fails this guard while loading the config file.

Solutions

  1. Set updateSnapshots to one of the allowed values: "all", "changed", "missing", "none" or "default"
  2. Remove the updateSnapshots key entirely to fall back to its default behavior
  3. Check for typos such as "only" or "yes" that are not valid modes
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/playwright/src/common/configLoader.ts:242 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/playwright@500c9c822c (2026-09-15). Data as JSON: /api/errors/62a348ae8364df97. Report an issue: GitHub.

Appendix: source

Thrown at packages/playwright/src/common/configLoader.ts:242

      throw errorWithFile(file, `config.reportSlowTests must be an object`);
    if (!('max' in config.reportSlowTests) || typeof config.reportSlowTests.max !== 'number' || config.reportSlowTests.max < 0)
      throw errorWithFile(file, `config.reportSlowTests.max must be a non-negative number`);
    if (!('threshold' in config.reportSlowTests) || typeof config.reportSlowTests.threshold !== 'number' || config.reportSlowTests.threshold < 0)
      throw errorWithFile(file, `config.reportSlowTests.threshold must be a non-negative number`);
  }

  if ('shard' in config && config.shard !== undefined && config.shard !== null) {
    if (!config.shard || typeof config.shard !== 'object')
      throw errorWithFile(file, `config.shard must be an object`);
    if (!('total' in config.shard) || typeof config.shard.total !== 'number' || config.shard.total < 1)
      throw errorWithFile(file, `config.shard.total must be a positive number`);
    if (!('current' in config.shard) || typeof config.shard.current !== 'number' || config.shard.current < 1 || config.shard.current > config.shard.total)
      throw errorWithFile(file, `config.shard.current must be a positive number, not greater than config.shard.total`);
  }

  if ('updateSnapshots' in config && config.updateSnapshots !== undefined) {
    if (typeof config.updateSnapshots !== 'string' || !['all', 'changed', 'missing', 'none', 'default'].includes(config.updateSnapshots))
      throw errorWithFile(file, `config.updateSnapshots must be one of "all", "changed", "missing", "none" or "default"`);
  }

  if ('retryStrategy' in config && config.retryStrategy !== undefined) {
    if (typeof config.retryStrategy !== 'string' || !['immediate', 'isolated'].includes(config.retryStrategy))
      throw errorWithFile(file, `config.retryStrategy must be one of "immediate" or "isolated"`);
  }

  if ('tsconfig' in config && config.tsconfig !== undefined) {
    if (typeof config.tsconfig !== 'string')
      throw errorWithFile(file, `config.tsconfig must be a string`);
    if (!fs.existsSync(path.resolve(file, '..', config.tsconfig)))
      throw errorWithFile(file, `config.tsconfig does not exist`);
  }
}

function validateProject(file: string, project: Project, title: string) {
  if (typeof project !== 'object' || !project)
    throw errorWithFile(file, `${title} must be an object`);

View on GitHub (pinned to 500c9c822c)