{"record":{"id":"2895783f2cd7e579","repo":"puppetlabs/puppet","slug":"invalid-startup-info-key-key","errorCode":null,"errorMessage":"invalid startup_info key '#{key}'","messagePattern":"invalid startup_info key '#(.+?)'","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/util/windows/monkey_patches/process.rb","lineNumber":231,"sourceCode":"    end\n\n    def validate_args(args)\n      raise TypeError, 'hash keyword arguments expected' unless args.is_a?(Hash)\n    end\n\n    def validate_keys(args)\n      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","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/util/windows/monkey_patches/process.rb#L213-L249","documentation":"Inside Process.create, the :startup_info sub-hash is validated against VALID_SI_KEYS (startf_flags, desktop, title, x, y, x_size, y_count_chars-family sizes, fill_attribute, sw_flags, stdin, stdout, stderr) and any other key raises ArgumentError('invalid startup_info key ...'). These keys map one-to-one onto members of the Win32 STARTUPINFO struct that CreateProcess receives.","triggerScenarios":"Putting options like :show_window (correct name is :sw_flags), :cwd, :creation_flags, or :hide inside startup_info; forwarding a raw STARTUPINFO-style hash from C-oriented docs (e.g. :wShowWindow, :dwFlags) instead of this API's ruby-ish names; typos like :std_out.","commonSituations":"Translating MSDN CreateProcess samples into Ruby; mixing top-level and startup_info options after refactors; version drift where a wrapper added convenience keys the patched validator never accepted.","solutions":["Use only the accepted startup_info keys: startf_flags desktop title x y x_size y_size x_count_chars y_count_chars fill_attribute sw_flags stdin stdout stderr","Rename MSDN-style members: wShowWindow -> sw_flags, dwFlags -> startf_flags, dwX -> x","Give startup_info only console/GUI concerns; everything else stays at the top level of the create hash"],"exampleFix":"// before\nProcess.create(command_line: 'dir', startup_info: { show_window: false })  # invalid key\n\n// after\nProcess.create(command_line: 'dir', startup_info: { sw_flags: Process::SW_HIDE })","handlingStrategy":"validation","validationCode":"VALID_SI_KEYS = %i[startf_flags desktop title x y x_size y_size x_count_chars\n                  y_count_chars fill_attribute sw_flags stdin stdout stderr].freeze\nunknown = args.fetch(:startup_info, {}).keys.map { |k| k.to_s.to_sym } - VALID_SI_KEYS\nraise ArgumentError, \"unknown startup_info keys: #{unknown.join(', ')}\" unless unknown.empty?","typeGuard":null,"tryCatchPattern":"begin\n  info = Process.create(args)\nrescue ArgumentError => e\n  raise unless e.message =~ /invalid startup_info key/\n  raise \"startup_info accepts only STARTUPINFO members: #{e.message}\"\nend","preventionTips":["Map MSDN STARTUPINFO names to this API's names (wShowWindow -> sw_flags, dwFlags -> startf_flags)","Keep console/GUI options inside startup_info and process options outside it","Validate the sub-hash separately in wrappers that compose it from several sources"],"tags":["windows","process","argumenterror","startup-info","option-validation","puppet"],"backgroundTag":"invalid-configuration-key","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}