{"record":{"id":"f22c74753ac82d55","repo":"puppetlabs/puppet","slug":"some-pre-run-checks-failed","errorCode":null,"errorMessage":"Some pre-run checks failed","messagePattern":"Some pre-run checks failed","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/transaction.rb","lineNumber":90,"sourceCode":"  #\n  # @see Puppet::Transaction#evaluate\n  # @see Puppet::Type#pre_run_check\n  # @raise [Puppet::Error] If any pre-run checks failed.\n  # @return [void]\n  def perform_pre_run_checks\n    prerun_errors = {}\n\n    @catalog.vertices.each do |res|\n      res.pre_run_check\n    rescue Puppet::Error => detail\n      prerun_errors[res] = detail\n    end\n\n    unless prerun_errors.empty?\n      prerun_errors.each do |res, detail|\n        res.log_exception(detail)\n      end\n      raise Puppet::Error, _(\"Some pre-run checks failed\")\n    end\n  end\n\n  # This method does all the actual work of running a transaction.  It\n  # collects all of the changes, executes them, and responds to any\n  # necessary events.\n  def evaluate(&block)\n    block ||= method(:eval_resource)\n    generator = AdditionalResourceGenerator.new(@catalog, nil, @prioritizer)\n    @catalog.vertices.each { |resource| generator.generate_additional_resources(resource) }\n\n    perform_pre_run_checks\n\n    persistence.load if persistence.enabled?(catalog)\n\n    Puppet.info _(\"Applying configuration version '%{version}'\") % { version: catalog.version } if catalog.version\n\n    continue_while = -> { !stop_processing? }","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/transaction.rb#L72-L108","documentation":"Before applying a catalog, Puppet::Transaction#perform_pre_run_checks calls pre_run_check on every resource in the catalog. This hook lets resource types validate state that depends on the complete catalog (the base Puppet::Type implementation at lib/puppet/type.rb:1028 is a no-op; custom and third-party types override it). If any check raises Puppet::Error, each failure is logged per-resource via log_exception and the whole transaction aborts with 'Some pre-run checks failed' before any resource is synced.","triggerScenarios":"A catalog containing a custom resource type whose pre_run_check raises Puppet::Error (e.g., a mount-like type detecting a missing fstab entry, or a type verifying a peer resource exists). One bad resource fails the entire run, even if unrelated resources were healthy.","commonSituations":"Custom in-house types or module-provided types (often via ruby providers) enforcing cross-resource invariants; upgrading a module that adds stricter pre-run validation; node drift (missing /etc/fstab entry, absent device) that only manifests at apply time.","solutions":["Read the agent log immediately above the raise: each failing resource logs its own exception with the specific reason","Fix the underlying condition reported by that resource (e.g., restore the fstab entry or device the custom type checks)","If the check is too strict for your nodes, patch or configure the custom type/module that implements pre_run_check","Re-run with puppet agent --test --debug for the full per-resource backtrace"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  Puppet::Transaction.new(catalog, report).evaluate\nrescue Puppet::Error => e\n  if e.message == 'Some pre-run checks failed'\n    report.logs.map(&:message).grep(/pre.?run|failed/).each { |m| warn m } # per-resource causes are in the logs\n  else\n    raise\n  end\nend","preventionTips":["Treat pre_run_check failures as fatal and surface the per-resource log lines above the raise","For custom types, keep pre_run_check narrow and message-rich: raise Puppet::Error, 'specific reason'","Smoke-test custom types on clean nodes in CI so environmental preconditions are caught before production"],"tags":["puppet","transaction","catalog","pre-run-check","custom-type"],"backgroundTag":"preflight-check-failed","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}