puppetlabs/puppet · error · Puppet::Error
No input to parse given on command line or stdin
Error message
No input to parse given on command line or stdin
What it means
`puppet parser dump` needs Puppet code from one of three sources: the -e inline string, file arguments, or piped (non-TTY) STDIN. When none is available — no -e, no positional args, and STDIN is an interactive terminal — it raises Puppet::Error rather than silently blocking on keyboard input.
Source
Thrown at lib/puppet/face/parser.rb:154
option('--format ' + _('<old, pn, or json>')) do
summary _("Get result in 'old' (deprecated format), 'pn' (new format), or 'json' (new format in JSON).")
end
option('--pretty') do
summary _('Pretty print output. Only applicable together with --format pn or json')
end
when_invoked do |*args|
require_relative '../../puppet/pops'
options = args.pop
if options[:e]
dump_parse(options[:e], 'command-line-string', options, false)
elsif args.empty?
if !STDIN.tty?
dump_parse(STDIN.read, 'stdin', options, false)
else
raise Puppet::Error, _("No input to parse given on command line or stdin")
end
else
files = args
available_files = files.select do |file|
Puppet::FileSystem.exist?(file)
end
missing_files = files - available_files
dumps = available_files.collect do |file|
dump_parse(Puppet::FileSystem.read(file, :encoding => 'utf-8'), file, options)
end.join("")
if missing_files.empty?
dumps
else
dumps + _("One or more file(s) specified did not exist:\n") + missing_files.collect { |f| " #{f}" }.join("\n")
end
endView on GitHub (pinned to e227c27540)
Solutions
- Pass code inline: `puppet parser dump -e 'notify { "x": }'`
- Pass manifest files: `puppet parser dump init.pp`
- Pipe code in: `cat init.pp | puppet parser dump`
Example fix
# before
puppet parser dump
# after
puppet parser dump -e 'notify { "hello": message => "hi" }' Defensive patterns
Strategy: validation
Validate before calling
abort 'nothing to parse: pass -e, file arguments, or pipe stdin' if ARGV.empty? && !ENV.key?('PUPPET_PARSER_EXPR') && $stdin.tty? && !options[:e] Prevention
- In scripts, always pass -e or explicit file paths rather than relying on stdin
- Check $stdin.tty? before invoking parser dump with no arguments
When it happens
Trigger: Bare `puppet parser dump` in an interactive shell; a wrapper that forgets to pass -e or file paths; a pipeline where the producer command failed so STDIN fell back to the TTY.
Common situations: Exploring the new parser output interactively; CI harnesses calling parser dump with dynamically built argument lists that end up empty.
Related errors
- The legacy subcommand '%{sub_command}' does not support supp
- One or more file(s) specified did not exist: %{files}
- Error parsing arguments
- The puppet agent command does not take parameters
- puppet %{face} %{action} takes %{arg_count} argument, but yo
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/134e08771b7e8c18.
Report an issue: GitHub.