puppetlabs/puppet · error · Puppet::Error
Environment '%{env}', cannot find environment_data_provider
Error message
Environment '%{env}', cannot find environment_data_provider '%{provider}' What it means
LookupAdapter resolves an environment data provider from environment.conf's environment_data_provider setting. Only three values are accepted: 'none' (no provider), 'hiera' (use hiera.yaml / defaults), and 'function' (environment::data function via HieraConfigV5.v4_function_config). Any other string raises Puppet::Error naming the environment and the bad value. The surrounding code also emits deprecation warnings — the setting itself is legacy, superseded by hiera.yaml version 5.
Source
Thrown at lib/puppet/pops/lookup/lookup_adapter.rb:517
else
unless Puppet[:strict] == :off
msg = _("Defining environment_data_provider='%{provider_name}' in environment.conf is deprecated.") % { provider_name: provider_name }
msg += " " + _("A '%{hiera_config}' file should be used instead") % { hiera_config: HieraConfig::CONFIG_FILE_NAME } if ep.nil?
Puppet.warn_once('deprecations', 'environment.conf#data_provider', msg, env_path + 'environment.conf')
end
case provider_name
when 'none'
nil
when 'hiera'
# Use hiera.yaml or default settings if it is missing
ep || EnvironmentDataProvider.new
when 'function'
ep = EnvironmentDataProvider.new
ep.config = HieraConfigV5.v4_function_config(env_path, 'environment::data', ep)
ep
else
raise Puppet::Error, _("Environment '%{env}', cannot find environment_data_provider '%{provider}'") % { env: environment.name, provider: provider_name }
end
end
end
# @return [Puppet::Node::Environment] the environment of the compiler that this adapter is associated with
def environment
@compiler.environment
end
end
end
end
require_relative 'invocation'
require_relative 'global_data_provider'
require_relative 'environment_data_provider'
require_relative 'module_data_provider'
View on GitHub (pinned to e227c27540)
Solutions
- Remove environment_data_provider from environment.conf and configure providers via a version-5 hiera.yaml in the environment — the modern replacement.
- If the setting must stay, use exactly one of none, hiera, or function (lowercase).
- Replace module_data module providers with module hiera.yaml (version 5) + data functions.
Example fix
# before: environments/production/environment.conf
environment_data_provider = module_data
# after: remove that line; add environments/production/hiera.yaml
version: 5
defaults:
datadir: data
data_hash: yaml_data
hierarchy:
- name: per-node
path: "nodes/%{trusted.certname}.yaml"
- name: common
path: common.yaml Defensive patterns
Strategy: validation
Validate before calling
# Fail fast on unsupported environment_data_provider values
VALID = %w[none hiera function].freeze
Dir['environments/*/environment.conf'].each do |f|
File.foreach(f) do |line|
if (v = line[/^\s*environment_data_provider\s*=\s*(\S+)/, 1])
abort "#{f}: environment_data_provider '#{v}' invalid (use #{VALID.join('/')}, or remove the setting)" unless VALID.include?(v)
end
end
end Prevention
- Prefer dropping environment_data_provider entirely and configuring providers in a version-5 hiera.yaml.
- If kept, restrict values to exactly none, hiera, or function (lowercase).
- Replace Puppet 4-era module_data modules with module hiera.yaml + data functions before upgrading Puppet.
When it happens
Trigger: environment.conf with `environment_data_provider = module_data` (the old Puppet 4 module_data provider), `data_api`, or any typo like 'Hiera' (case-sensitive); only reached when no version>=5 hiera.yaml config already took over (which nils the provider name).
Common situations: Modules written for Puppet 4's experimental data providers using module_data; environments migrated forward without cleaning environment.conf; case or whitespace mistakes in the value.
Related errors
- manifest of environment '#{@environment.name}' appoints dire
- manifest of environment '#{@environment.name}' appoints '#{f
- field 'data_provider' contains non-alphanumeric characters
- field 'data_provider' must begin with a letter
- field 'data_provider' must be a string
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/34104ae82107b846.
Report an issue: GitHub.