{"record":{"id":"ead242c3758fd416","repo":"puppetlabs/puppet","slug":"command-line-or-app-name-must-be-specified","errorCode":null,"errorMessage":"command_line or app_name must be specified","messagePattern":"command_line or app_name must be specified","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/util/windows/monkey_patches/process.rb","lineNumber":238,"sourceCode":"      args.each do |key, val|\n        key = key.to_s.to_sym\n        raise ArgumentError, \"invalid key '#{key}'\" unless VALID_KEYS.include?(key)\n\n        hash[key] = val\n      end\n    end\n\n    def validate_startup_info\n      hash[:startup_info].each do |key, val|\n        key = key.to_s.to_sym\n        raise ArgumentError, \"invalid startup_info key '#{key}'\" unless VALID_SI_KEYS.include?(key)\n\n        si_hash[key] = val\n      end\n    end\n\n    def validate_command_line\n      raise ArgumentError, 'command_line or app_name must be specified' unless hash[:app_name] || hash[:command_line]\n    end\n\n    def procinfo\n      @procinfo ||= PROCESS_INFORMATION.new\n    end\n\n    def hash\n      @hash ||= {}\n    end\n\n    def si_hash\n      @si_hash ||= {}\n    end\n\n    def app\n      wide_string(hash[:app_name])\n    end\n","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/util/windows/monkey_patches/process.rb#L220-L256","documentation":"Process.create requires at least one of :app_name or :command_line so CreateProcess has something to launch; validate_command_line raises ArgumentError('command_line or app_name must be specified') when both are nil. This fires during argument validation, before any Win32 process API is touched - the hash is structurally valid but empty of the one mandatory option.","triggerScenarios":"Process.create(cwd: 'C:\\tmp') with neither :command_line nor :app_name; a builder that assigns command_line conditionally (e.g. only when a template interpolates non-empty) and silently yields nil; option hashes deep-merged where a nil command_line overrides a default.","commonSituations":"Wrapper functions taking an optional command that is skipped for 'default' runs; config-driven spawning where the command key is misspelled (so it lands under an invalid key or is dropped before create); test helpers calling Process.create({}).","solutions":["Always pass :command_line (preferred) or :app_name","Fail fast in your wrapper: raise ArgumentError unless opts[:command_line] || opts[:app_name]","Check for misspelled keys (:cmd, :command) that leave the real options unset","Prefer :command_line when setting only one - it does not require an absolute path or extension"],"exampleFix":"// before\nProcess.create(cwd: 'C:\\\\work')  # nothing to launch -> ArgumentError\n\n// after\nProcess.create(command_line: 'rake build', cwd: 'C:\\\\work')","handlingStrategy":"validation","validationCode":"raise ArgumentError, 'command_line or app_name is required' unless args[:command_line] || args[:app_name]\nProcess.create(args)","typeGuard":null,"tryCatchPattern":"begin\n  info = Process.create(args)\nrescue ArgumentError => e\n  raise unless e.message.include?('command_line or app_name')\n  raise 'spawn target missing - check config key spelling (:command_line vs :cmd)'\nend","preventionTips":["Fail fast on a missing command in your own wrapper before calling create","Prefer :command_line over :app_name - no absolute path or extension needed","Check for upstream key typos that silently leave command_line nil"],"tags":["windows","process","argumenterror","missing-argument","puppet"],"backgroundTag":"missing-required-parameter","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}