avajs/ava · error · Error
Encountered ’ava’ property in ${fileForErrorMessage}; avoid
Error message
Encountered ’ava’ property in ${fileForErrorMessage}; avoid wrapping the configuration What it means
Guard in loadConfig: the config file contains an 'ava' key, indicating the configuration was wrapped to mimic the package.json style where AVA config lives under an 'ava' property. Standalone config files must export the configuration at the top level; the 'ava' property is the erroneous input.
Source
Thrown at lib/load-config.js:151
packageConf = {};
} else if (Object.keys(packageConf).length > 0) {
throw new Error(`Conflicting configuration in ${fileForErrorMessage} and package.json`);
}
if (!isPlainObject(fileConf) && typeof fileConf !== 'function') {
throw new TypeError(`${fileForErrorMessage} must export a plain object or factory function`);
}
if (typeof fileConf === 'function') {
fileConf = await fileConf({projectDir});
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`);
}View on GitHub (pinned to bbfd946322)
Solutions
- Unwrap the config: move the contents of the 'ava' object to the top level of the export
- Use the 'ava' nesting only inside package.json, not in ava.config.js/mjs
- Rename unrelated 'ava' keys in your config if they were intentional data
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/load-config.js:151 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/8d0c94d69e66f8d9.
Report an issue: GitHub.