{"record":{"id":"f760ce5985c33063","repo":"puppetlabs/puppet","slug":"i-don-t-know-how-to-render-format","errorCode":null,"errorMessage":"I don't know how to render '%{format}'","messagePattern":"I don't know how to render '%(.+?)'","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/application/face_base.rb","lineNumber":36,"sourceCode":"  end\n\n  option(\"--help\", \"-h\") do |_arg|\n    if action && !@is_default_action\n      # Only invoke help on the action if it was specified, not if\n      # it was the default action.\n      puts Puppet::Face[:help, :current].help(face.name, action.name)\n    else\n      puts Puppet::Face[:help, :current].help(face.name)\n    end\n    exit(0)\n  end\n\n  attr_reader :render_as\n  attr_accessor :face, :action, :type, :arguments\n\n  def render_as=(format)\n    @render_as = Puppet::Network::FormatHandler.format(format)\n    @render_as or raise ArgumentError, _(\"I don't know how to render '%{format}'\") % { format: format }\n  end\n\n  def render(result, args_and_options)\n    hook = action.when_rendering(render_as.name)\n\n    if hook\n      # when defining when_rendering on your action you can optionally\n      # include arguments and options\n      if hook.arity > 1\n        result = hook.call(result, *args_and_options)\n      else\n        result = hook.call(result)\n      end\n    end\n\n    render_as.render(result)\n  end\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/application/face_base.rb#L18-L54","documentation":"FaceBase#render_as= resolves the requested output format through Puppet::Network::FormatHandler.format; an unknown name yields nil and ArgumentError 'I don't know how to render' fires. Only formats registered with FormatHandler (before this assignment) are selectable as render targets.","triggerScenarios":"Passing --render_as with a typo'd or unregistered name ('yml' instead of 'yaml', 'yolo'); code setting app.render_as = 'custom' where the registering plugin/gem is not loaded; format names that differ across puppet versions.","commonSituations":"Scripts assuming a format name from an older puppet version; custom output formats provided by a face/plugin that is not installed on the node; automation piping puppet face output into tools expecting a specific serializer.","solutions":["List what is available: Puppet::Network::FormatHandler.supported_formats (json, yaml, s, console, ...) and use one of those","Fix the typo in the --render_as value","If a custom format is genuinely required, register it with Puppet::Network::FormatHandler.create before render_as is assigned"],"exampleFix":"# before\npuppet module list --render_as yml   # unregistered name\n\n# after\npuppet module list --render_as yaml","handlingStrategy":"validation","validationCode":"fmt = 'yaml'\nraise ArgumentError, \"unknown render format #{fmt}\" unless Puppet::Network::FormatHandler.format(fmt)\napp.render_as = fmt","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Source render-format choices from Puppet::Network::FormatHandler.supported_formats","Fail early on nil from FormatHandler.format before assigning render_as","Load any plugin that registers custom formats before the CLI parses --render_as"],"tags":["rendering","format","face","puppet"],"backgroundTag":"unsupported-format","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}