puppetlabs/puppet · error · ArgumentError
Cannot have both `ensure => disabled` and `flavor`
Error message
Cannot have both `ensure => disabled` and `flavor`
What it means
The package type's flavor property (OpenBSD flavors, DNF module profiles) validates against `ensure => disabled`: disabling a package while also selecting a flavor is contradictory, so ArgumentError 'Cannot have both `ensure => disabled` and `flavor`' is raised.
Source
Thrown at lib/puppet/type/package.rb:421
super(currentvalue)
end
end
def change_to_s(currentvalue, newvalue)
if provider.respond_to?(:package_settings_change_to_s)
provider.package_settings_change_to_s(currentvalue, newvalue)
else
super(currentvalue, newvalue)
end
end
end
newproperty(:flavor, :required_features => :supports_flavors) do
desc "OpenBSD and DNF modules support 'flavors', which are
further specifications for which type of package you want."
validate do |value|
if [:disabled, "disabled"].include?(@resource[:ensure]) && value
raise ArgumentError, _('Cannot have both `ensure => disabled` and `flavor`')
end
end
end
newparam(:source) do
desc "Where to find the package file. This is mostly used by providers that don't
automatically download packages from a central repository. (For example:
the `yum` provider ignores this attribute, `apt` provider uses it if present
and the `rpm` and `dpkg` providers require it.)
Different providers accept different values for `source`. Most providers
accept paths to local files stored on the target system. Some providers
may also accept URLs or network drive paths. Puppet will not
automatically retrieve source files for you, and usually just passes the
value of `source` to the package installation command.
You can use a `file` resource if you need to manually copy package files
to the target system."View on GitHub (pinned to e227c27540)
Solutions
- Remove `flavor` on resources where ensure => disabled (or change ensure).
- Make them mutually exclusive in data: `flavor => $ensure ? { 'disabled' => undef, default => 'default' }`.
- Audit layers with `puppet lookup flavor --explain` and `puppet lookup ensure --explain`.
- For DNF modules use enable_only instead of flavor when disabling.
Example fix
// before
package { 'postgresql':
ensure => disabled,
flavor => 'minimal',
}
// after
package { 'postgresql':
ensure => disabled,
} Defensive patterns
Strategy: validation
Validate before calling
// Puppet
if $flavor != undef and $ensure == 'disabled' {
fail('flavor cannot be combined with ensure => disabled')
} Prevention
- Make flavor conditional on ensure in shared data.
- Use puppet lookup --explain for both keys on affected nodes.
- Keep disable profiles and flavored installs in separate classes.
When it happens
Trigger: `package { 'postgresql': ensure => disabled, flavor => 'minimal' }`; Hiera data merging that sets flavor on a resource whose ensure resolves to disabled; parameterized classes combining both flags through defaults.
Common situations: Shared Hiera data applying flavor globally while some nodes disable the package; refactors flipping ensure to disabled without removing flavor; copy-paste combining flavor examples from module docs with disable recipes.
Related errors
- Cannot have both `enable_only => true` and `flavor`
- The ssl_context and include_system_store parameters are mutu
- Cannot have both 'forcelocal' and 'ia_load_module' at the sa
- Modules are not supported on DNF versions lower than 3.0.1
- No valid installpath found in /etc/pkg.conf and no source wa
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/13662e08bd4557ed.
Report an issue: GitHub.