{"record":{"id":"d044f92b54cce914","repo":"puppetlabs/puppet","slug":"the-puppet-agent-command-does-not-take-parameters","errorCode":null,"errorMessage":"The puppet agent command does not take parameters","messagePattern":"The puppet agent command does not take parameters","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/application/agent.rb","lineNumber":470,"sourceCode":"\n  def main(daemon)\n    Puppet.notice _(\"Starting Puppet client version %{version}\") % { version: Puppet.version }\n    daemon.start\n  end\n\n  # Enable all of the most common test options.\n  def setup_test\n    Puppet.settings.handlearg(\"--no-usecacheonfailure\")\n    Puppet.settings.handlearg(\"--no-splay\")\n    Puppet.settings.handlearg(\"--show_diff\")\n    Puppet.settings.handlearg(\"--no-daemonize\")\n    options[:verbose] = true\n    Puppet[:onetime] = true\n    options[:detailed_exitcodes] = true\n  end\n\n  def setup\n    raise ArgumentError, _(\"The puppet agent command does not take parameters\") unless command_line.args.empty?\n\n    setup_test if options[:test]\n\n    setup_logs\n\n    exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?\n\n    Puppet::SSL::Oids.register_puppet_oids\n\n    if options[:fqdn]\n      Puppet[:certname] = options[:fqdn]\n    end\n\n    Puppet.settings.use :main, :agent, :ssl\n\n    Puppet::Transaction::Report.indirection.terminus_class = :rest\n    # we want the last report to be persisted locally\n    Puppet::Transaction::Report.indirection.cache_class = :yaml","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/application/agent.rb#L452-L488","documentation":"Puppet::Application::Agent#setup raises ArgumentError unless command_line.args is empty: 'puppet agent' accepts flags only, no positional parameters. Any word after 'agent' that is not an option is treated as a parameter and aborts agent startup during setup.","triggerScenarios":"Running 'puppet agent puppet.example.com' (the server must be set with --server), 'puppet agent --test leftover', or a wrapper forwarding stray positional words into the agent command line.","commonSituations":"Muscle memory from tools that take a hostname positionally; unquoted shell variables expanding into extra words; scripts appending log paths or hostnames after 'puppet agent'.","solutions":["Move the value onto a flag: puppet agent --server puppet.example.com","Remove all positional words after 'puppet agent'; print the full command the wrapper builds to see what snuck in","Quote shell expansions used in flag values so they do not split into extra arguments"],"exampleFix":"# before\npuppet agent puppet.example.com\n\n# after\npuppet agent --server puppet.example.com","handlingStrategy":"validation","validationCode":"positional = ARGV.drop_while { |a| a.start_with?('-') } # after subcommand\nunless positional.empty?\n  abort 'puppet agent takes flags only — use --server <host>, not a positional host'\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set hosts with --server, never positionally","Quote shell variables used to build agent commands so they cannot add stray words","Dry-run wrapper-built commands (echo them) before executing in cron"],"tags":["cli","agent","arguments","puppet"],"backgroundTag":"invalid-command-line-arguments","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}