{"record":{"id":"34104ae82107b846","repo":"puppetlabs/puppet","slug":"environment-env-cannot-find-environment-data","errorCode":null,"errorMessage":"Environment '%{env}', cannot find environment_data_provider '%{provider}'","messagePattern":"Environment '%(.+?)', cannot find environment_data_provider '%(.+?)'","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/lookup/lookup_adapter.rb","lineNumber":517,"sourceCode":"    else\n      unless Puppet[:strict] == :off\n        msg = _(\"Defining environment_data_provider='%{provider_name}' in environment.conf is deprecated.\") % { provider_name: provider_name }\n        msg += \" \" + _(\"A '%{hiera_config}' file should be used instead\") % { hiera_config: HieraConfig::CONFIG_FILE_NAME } if ep.nil?\n        Puppet.warn_once('deprecations', 'environment.conf#data_provider', msg, env_path + 'environment.conf')\n      end\n\n      case provider_name\n      when 'none'\n        nil\n      when 'hiera'\n        # Use hiera.yaml or default settings if it is missing\n        ep || EnvironmentDataProvider.new\n      when 'function'\n        ep = EnvironmentDataProvider.new\n        ep.config = HieraConfigV5.v4_function_config(env_path, 'environment::data', ep)\n        ep\n      else\n        raise Puppet::Error, _(\"Environment '%{env}', cannot find environment_data_provider '%{provider}'\") % { env: environment.name, provider: provider_name }\n      end\n    end\n  end\n\n  # @return [Puppet::Node::Environment] the environment of the compiler that this adapter is associated with\n  def environment\n    @compiler.environment\n  end\nend\nend\nend\n\nrequire_relative 'invocation'\nrequire_relative 'global_data_provider'\nrequire_relative 'environment_data_provider'\nrequire_relative 'module_data_provider'\n","sourceCodeStart":499,"sourceCodeEnd":534,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/lookup/lookup_adapter.rb#L499-L534","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before: environments/production/environment.conf\nenvironment_data_provider = module_data\n\n# after: remove that line; add environments/production/hiera.yaml\nversion: 5\ndefaults:\n  datadir: data\n  data_hash: yaml_data\nhierarchy:\n  - name: per-node\n    path: \"nodes/%{trusted.certname}.yaml\"\n  - name: common\n    path: common.yaml","handlingStrategy":"validation","validationCode":"# Fail fast on unsupported environment_data_provider values\nVALID = %w[none hiera function].freeze\nDir['environments/*/environment.conf'].each do |f|\n  File.foreach(f) do |line|\n    if (v = line[/^\\s*environment_data_provider\\s*=\\s*(\\S+)/, 1])\n      abort \"#{f}: environment_data_provider '#{v}' invalid (use #{VALID.join('/')}, or remove the setting)\" unless VALID.include?(v)\n    end\n  end\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["puppet","environment-conf","data-provider","deprecated-setting","puppet-error"],"backgroundTag":"puppet-invalid-environment-data-provider","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}