avajs/ava · error · Error

filterNodeArgumentsForWorkerThreads from ${fileForErrorMessa

Error message

filterNodeArgumentsForWorkerThreads from ${fileForErrorMessage} must be a function

What it means

Guard in loadConfig: after merging defaults, file config, and package.json config, config.filterNodeArgumentsForWorkerThreads exists but is not a function. This hook filters Node arguments for worker threads; a non-function (string, boolean, or typo-derived value) was supplied. The input at fault is that merged property.

Source

Thrown at lib/load-config.js:163

			if (!isPlainObject(fileConf)) {
				throw new TypeError(`Factory method exported by ${fileForErrorMessage} must return a plain object`);
			}
		}

		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)

Solutions

  1. Define it as a function: module.exports = {filterNodeArgumentsForWorkerThreads: args => args.filter(...)}
  2. Remove the key if you do not intend to filter node arguments
  3. Check for typos or a value copied from a string-based config format
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at lib/load-config.js:163 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/871c07c4dfc672cd. Report an issue: GitHub.