avajs/ava · error · Error

nonSemVerExperiments from

Error message

nonSemVerExperiments from ${fileForErrorMessage} must be an object

What it means

Guard in loadConfig: the merged nonSemVerExperiments value is not a plain object. It must be a map of experiment-name-to-flag values; a string, array, boolean, or null was supplied (directly or via the fileConf/packageConf spread). The input at fault is config.nonSemVerExperiments.

Solutions

  1. Set nonSemVerExperiments to an object literal of experiment flags only
  2. Remove the key entirely if not experimenting
  3. Fix JSON/JS syntax that accidentally assigns a scalar to the key
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at lib/load-config.js:168 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of avajs/ava@bbfd946322 (2026-09-02). Data as JSON: /api/errors/e8bb54121c163881. Report an issue: GitHub.

Appendix: source

Thrown at lib/load-config.js:168

		if ('ava' in fileConf) {
			throw new Error(`Encountered ’ava’ property in ${fileForErrorMessage}; avoid wrapping the configuration`);
		}
	}

	const config = {
		...defaults, nonSemVerExperiments: {}, ...fileConf, ...packageConf, projectDir, configFile,
	};

	if (
		'filterNodeArgumentsForWorkerThreads' in config
		&& typeof config.filterNodeArgumentsForWorkerThreads !== 'function'
	) {
		throw new Error(`filterNodeArgumentsForWorkerThreads from ${fileForErrorMessage} must be a function`);
	}

	const {nonSemVerExperiments: experiments} = config;
	if (!isPlainObject(experiments)) {
		throw new Error(`nonSemVerExperiments from ${fileForErrorMessage} must be an object`);
	}

	for (const key of Object.keys(experiments)) {
		if (!EXPERIMENTS.has(key)) {
			throw new Error(`nonSemVerExperiments.${key} from ${fileForErrorMessage} is not a supported experiment`);
		}
	}

	return {config, unsupportedFiles};
}

View on GitHub (pinned to bbfd946322)