tailwindlabs/tailwindcss · error · Error
Error in the config file/plugin/preset. An empty preset (`pr
Error message
Error in the config file/plugin/preset. An empty preset (`preset: []`) is not currently supported.
What it means
Thrown in `resolve-config.ts` when `config.presets` is an array of length zero. Tailwind v4 treats an explicitly empty `presets: []` as a distinct (and unsupported) intent — disabling all presets via an empty array is not implemented. The guard fires before iterating presets.
Source
Thrown at packages/tailwindcss/src/compat/config/resolve-config.ts:162
// Happens with `plugin.withOptions()` when no options were passed:
// e.g. `require("my-plugin")` instead of `require("my-plugin")(options)`
plugins.push({ ...plugin(), reference, src })
} else if ('handler' in plugin) {
// Happens with `plugin(…)`:
// e.g. `require("my-plugin")`
//
// or with `plugin.withOptions()` when the user passed options:
// e.g. `require("my-plugin")(options)`
plugins.push({ ...plugin, reference, src })
} else {
// Just a plain function without using the plugin(…) API
plugins.push({ handler: plugin, reference, src })
}
}
// Apply configs from presets
if (Array.isArray(config.presets) && config.presets.length === 0) {
throw new Error(
'Error in the config file/plugin/preset. An empty preset (`preset: []`) is not currently supported.',
)
}
for (let preset of config.presets ?? []) {
extractConfigs(ctx, { path, base, config: preset, reference, src })
}
// Apply configs from plugins
for (let plugin of plugins) {
ctx.plugins.push(plugin)
if (plugin.config) {
extractConfigs(ctx, {
path,
base,
config: plugin.config,
reference: !!plugin.reference,View on GitHub (pinned to 16e94cbf7f)
Solutions
- Remove the `presets: []` key entirely so Tailwind uses its default behavior.
- If you want a custom preset set, provide at least one preset entry in the array.
- Override individual theme keys directly instead of trying to clear presets.
Example fix
// before (tailwind.config.js)
module.exports = { presets: [] }
// after
module.exports = {} // or omit the presets key Defensive patterns
Strategy: validation
Validate before calling
function assertPresetsValid(config) {
if (Array.isArray(config.presets) && config.presets.length === 0) {
throw new Error('presets: [] is unsupported; omit the key instead');
}
}
// assertPresetsValid(config); Prevention
- Omit the `presets` key rather than setting it to an empty array.
- Add a migration codemod that strips `presets: []`.
When it happens
Trigger: Writing `module.exports = { presets: [] }` to try to disable default presets. `Array.isArray(config.presets) && config.presets.length === 0` is true.
Common situations: Migrating a v3 config that set `presets: []` to opt out of defaults; attempting to start from a blank slate.
Related errors
- Error in the config file/plugin/preset. The `content` key co
- Cannot apply unprefixed utility class `${candidate}`. Did yo
- Cannot apply utility class `${candidate}` because it has bee
- `@plugin` must have a path.
- Unexpected `@plugin` option: Value of declaration `${toCss([
AI-assisted analysis of tailwindlabs/tailwindcss@16e94cbf7f (2026-08-12).
Data as JSON: /api/errors/1e4d347bcac25cac.
Report an issue: GitHub.