{"record":{"id":"d645173699f0b135","repo":"puppetlabs/puppet","slug":"error-while-rendering-epp","errorCode":null,"errorMessage":"error while rendering epp","messagePattern":"error while rendering epp","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/face/epp.rb","lineNumber":359,"sourceCode":"        if options[:e]\n          buffer.print render_inline(options[:e], compiler, options)\n        elsif args.empty?\n          if !STDIN.tty?\n            buffer.print render_inline(STDIN.read, compiler, options)\n          else\n            raise Puppet::Error, _(\"No input to process given on command line or stdin\")\n          end\n        else\n          show_filename = args.count > 1\n          file_nbr = 0\n          args.each do |file|\n            buffer.print render_file(file, compiler, options, show_filename, file_nbr += 1)\n          rescue Puppet::ParseError => detail\n            Puppet.err(detail.message)\n            status = false\n          end\n        end\n        raise Puppet::Error, _(\"error while rendering epp\") unless status\n\n        buffer.string\n      end\n    end\n  end\n\n  def dump_parse(source, filename, options, show_filename = true)\n    output = ''.dup\n    evaluating_parser = Puppet::Pops::Parser::EvaluatingParser::EvaluatingEppParser.new\n    begin\n      if options[:validate]\n        parse_result = evaluating_parser.parse_string(source, filename)\n      else\n        # side step the assert_and_report step\n        parse_result = evaluating_parser.parser.parse_string(source)\n      end\n      if show_filename && options[:header]\n        output << \"--- #{filename}\\n\"","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/face/epp.rb#L341-L377","documentation":"Raised at the end of `puppet epp render` when rendering one or more files produced a `Puppet::ParseError`: the per-file rescue prints the error with `Puppet.err`, sets `status = false`, and after all files the final `raise ... unless status` fires. Renderable files have already been written to the buffer, but the face API is all-or-nothing so the output string is discarded and the command exits non-zero. The real diagnostic is the Puppet.err line printed above the raise.","triggerScenarios":"A template that parses but raises a ParseError during evaluation — references that fail parsing rules, EPP parameter-tag problems — or has outright syntax errors; with multiple files any single failure latches status even though the rest rendered.","commonSituations":"Rendering templates whose declared parameters are not supplied via --values; ERB-to-EPP migration leftovers; strict variable/undefined-variable behavior surfacing during render.","solutions":["Read the Puppet.err line above the raise — it carries the template name and the parse/evaluation error","Supply required parameters: `puppet epp render t.epp --values @values.json`","Check the EPP parameter block (`<%# parameters: ... -%>`) matches the values you pass","Validate first (`puppet epp validate t.epp`) and inspect the AST with `puppet epp dump t.epp`"],"exampleFix":"# before\npuppet epp render web/vhost.epp                      # required params missing\n# after\ncat > values.json <<'JSON'\n{ \"port\": 8080, \"name\": \"app\" }\nJSON\npuppet epp render web/vhost.epp --values @values.json","handlingStrategy":"try-catch","validationCode":"require 'puppet/pops/parser/evaluating_parser'\nparser = Puppet::Pops::Parser::EvaluatingParser::EvaluatingEppParser.new\nbegin\n  parser.parse_string(File.read(template), template)\nrescue Puppet::ParseError => e\n  abort \"#{template}: #{e.message}\"\nend","typeGuard":null,"tryCatchPattern":"begin\n  out = Puppet::Face[:epp, :current].render(files, values: params)\nrescue Puppet::Error => e\n  # message is 'error while rendering epp'; the Puppet.err lines above name the file and cause\n  files.each { |f| Puppet::Face[:epp, :current].validate(f) rescue nil }\n  raise\nend","preventionTips":["Validate templates before rendering them (`puppet epp validate`)","Always supply --values matching the EPP parameter declarations","For programmatic rendering prefer Puppet::ElasticTemplate-free APIs: Evaluator::EppEvaluator with an explicit scope, which gives precise errors"],"tags":["epp","template","render","parse-error"],"backgroundTag":"template-parse-error","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}