{"record":{"id":"8f82da7ae9f963bd","repo":"puppetlabs/puppet","slug":"could-not-find-indirection-indirection","errorCode":null,"errorMessage":"Could not find indirection '%{indirection}'","messagePattern":"Could not find indirection '%(.+?)'","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/indirector/request.rb","lineNumber":104,"sourceCode":"        @key = key\n      end\n    end\n\n    @key = @instance.name if !@key and @instance\n  end\n\n  # Look up the indirection based on the name provided.\n  def indirection\n    Puppet::Indirector::Indirection.instance(indirection_name)\n  end\n\n  def indirection_name=(name)\n    @indirection_name = name.to_sym\n  end\n\n  def model\n    ind = indirection\n    raise ArgumentError, _(\"Could not find indirection '%{indirection}'\") % { indirection: indirection_name } unless ind\n\n    ind.model\n  end\n\n  # Are we trying to interact with multiple resources, or just one?\n  def plural?\n    method == :search\n  end\n\n  def initialize_from_hash(hash)\n    @indirection_name = hash['indirection_name'].to_sym\n    @method = hash['method'].to_sym\n    @key = hash['key']\n    @instance = hash['instance']\n    @options = hash['options']\n  end\n\n  def to_data_hash","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/indirector/request.rb#L86-L122","documentation":"Puppet::Indirector::Request#model resolves the request's indirection_name through the global indirection registry (Puppet::Indirector::Indirection.instance). If no indirection was ever registered under that name, ArgumentError is raised. Registration happens when the model class calls e.g. extend Puppet::Indirector (indirects :catalog), so a typo'd name, or referencing an indirection whose defining file was never required, produces this error.","triggerScenarios":"Constructing Puppet::Indirector::Request.new(:nonexistent, :find, key, ...) in code or tests; deserializing a request from YAML with an indirection_name whose model class is not loaded; misspelling an indirection in custom faces or report tools (e.g., :nodes instead of :node).","commonSituations":"Custom tooling or RSpec fixtures that build Request objects directly with guessed names; code paths that lazy-load models in a different order than production; renames of indirections across Puppet versions.","solutions":["List registered indirections to verify the spelling: check each model class (Puppet::Node.indirects :node, Puppet::Resource::Catalog.indirects :catalog)","Require the model file explicitly before building the request: require 'puppet/node' etc.","Use the model's own indirection API instead of hand-built requests: Puppet::Node.indirection.find(key)","Inspect the request hash/serialization you are loading and correct the indirection_name value"],"exampleFix":"# before\nreq = Puppet::Indirection::Request.new(:nodes, :find, 'web01', nil)\nreq.model  # ArgumentError: Could not find indirection 'nodes'\n\n# after\nreq = Puppet::Indirection::Request.new(:node, :find, 'web01', nil)\nreq.model  # => Puppet::Node","handlingStrategy":"validation","validationCode":"unless Puppet::Indirector::Indirection.instance(indirection_name.to_sym)\n  raise ArgumentError, \"indirection '#{indirection_name}' is not registered; require its model first\"\nend","typeGuard":"def registered_indirection?(name)\n  !Puppet::Indirector::Indirection.instance(name.to_sym).nil?\nend","tryCatchPattern":null,"preventionTips":["Prefer model-level APIs (Puppet::Node.indirection.find) over hand-built Request objects","Require the model file before constructing requests in isolated tooling/tests","Assert indirection names with symbols taken from the model classes, not typed strings"],"tags":["puppet","indirector","registry","argument-error"],"backgroundTag":"handler-not-registered","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}