{"record":{"id":"56e32653f53c9d8e","repo":"puppetlabs/puppet","slug":"could-not-find-node-name-cannot-compile","errorCode":null,"errorMessage":"Could not find node '%{name}'; cannot compile","messagePattern":"Could not find node '%(.+?)'; cannot compile","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/indirector/catalog/compiler.rb","lineNumber":422,"sourceCode":"      else\n        return node\n      end\n    end\n\n    # We rely on our authorization system to determine whether the connected\n    # node is allowed to compile the catalog's node referenced by key.\n    # By default the REST authorization system makes sure only the connected node\n    # can compile his catalog.\n    # This allows for instance monitoring systems or puppet-load to check several\n    # node's catalog with only one certificate and a modification to auth.conf\n    # If no key is provided we can only compile the currently connected node.\n    name = request.key || request.node\n    node = find_node(name, request.environment, request.options[:transaction_uuid], request.options[:configured_environment], facts)\n    if node\n      return node\n    end\n\n    raise ArgumentError, _(\"Could not find node '%{name}'; cannot compile\") % { name: name }\n  end\n\n  # Initialize our server fact hash; we add these to each client, and they\n  # won't change while we're running, so it's safe to cache the values.\n  #\n  # See also set_server_facts in Puppet::Server::Compiler in puppetserver.\n  def set_server_facts\n    @server_facts = Puppet::Node::ServerFacts.load\n  end\nend\n","sourceCodeStart":404,"sourceCodeEnd":433,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/indirector/catalog/compiler.rb#L404-L433","documentation":"In the catalog compiler, when neither options[:use_node] nor a successful node lookup produces a node (Puppet::Node.indirection.find returns nil), ArgumentError 'Could not find node ...; cannot compile' is raised. Unlike the wrapped-lookup error, nothing threw — the configured node terminus simply had no entry for the requested name.","triggerScenarios":"node_terminus = plain with no node definition matching the certname; an ENC returning an empty document for the node (empty response is treated as not found); an LDAP query succeeding but matching no entry; requesting a catalog for a name that differs by case or trailing dot from the stored node name.","commonSituations":"ENC returning empty output for a new node; node_terminus=plain on a master with no matching node statement or site.pp entry; certname case or FQDN trailing-dot differences between the request and node data.","solutions":["Check the terminus first: run puppet node find <certname> --debug on the master to see exactly what the node terminus returns","If using an ENC, make it return a YAML classification for the node (empty or whitespace means not found)","Fix name mismatches: align certname with what the terminus keys on (watch case and trailing dot)","As a fallback, switch node_terminus to plain and rely on site.pp defaults"],"exampleFix":"# before: ENC returns nothing for new nodes\n#  => ArgumentError: Could not find node 'node1.example.com'; cannot compile\n\n# after: ENC emits yaml for the node\n#   printf 'classes: [base]\\nenvironment: production\\n' | /etc/puppet/node.rb node1.example.com\n# then: puppet agent -t","handlingStrategy":"try-catch","validationCode":"# ruby\nnode = Puppet::Node.indirection.find(certname)\nraise ArgumentError, \"node #{certname} unresolvable via #{Puppet[:node_terminus]}\" if node.nil?","typeGuard":"def node_known?(name)\n  !Puppet::Node.indirection.find(name).nil?\nend","tryCatchPattern":"begin\n  compiler.node_from_request(facts, request)\nrescue ArgumentError => e\n  raise unless e.message.include?('Could not find node')\n  nil  # investigate terminus (ENC output, name normalization)\nend","preventionTips":["Give ENCs an explicit default-class branch instead of returning empty for unknown nodes","Alert on repeated node-lookup failures — they usually mean ENC or LDAP gaps","Normalize names: watch trailing dots and case differences between certname and node data"],"tags":["puppet-compiler","node-lookup","enc","not-found","catalog"],"backgroundTag":"node-not-found","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}