{"record":{"id":"0e28cc3353f11d9a","repo":"puppetlabs/puppet","slug":"unknown-start-type-start-type-for-service","errorCode":null,"errorMessage":"Unknown start type '%{start_type}' for '%{service_name}'","messagePattern":"Unknown start type '%(.+?)' for '%(.+?)'","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/util/windows/service.rb","lineNumber":142,"sourceCode":"    # @param [String] service_name name of the service to query\n    # @return [QUERY_SERVICE_CONFIGW.struct] the configuration of the service\n    def service_start_type(service_name)\n      start_type = nil\n      open_service(service_name, SC_MANAGER_CONNECT, SERVICE_QUERY_CONFIG) do |service|\n        query_config(service) do |config|\n          start_type = SERVICE_START_TYPES[config[:dwStartType]]\n        end\n      end\n      # if the service has type AUTO_START, check if it's a delayed service\n      if start_type == :SERVICE_AUTO_START\n        open_service(service_name, SC_MANAGER_CONNECT, SERVICE_QUERY_CONFIG) do |service|\n          query_config2(service, SERVICE_CONFIG_DELAYED_AUTO_START_INFO) do |config|\n            return :SERVICE_DELAYED_AUTO_START if config[:fDelayedAutostart] == 1\n          end\n        end\n      end\n      if start_type.nil?\n        raise Puppet::Error, _(\"Unknown start type '%{start_type}' for '%{service_name}'\") % { start_type: start_type.to_s, service_name: service_name }\n      end\n\n      start_type\n    end\n    module_function :service_start_type\n\n    # Query the configuration of a service using QueryServiceConfigW\n    # to find its current logon account\n    #\n    # @return [String] logon_account account currently set for the service's logon\n    #  in the format \"DOMAIN\\Account\" or \".\\Account\" if it's a local account\n    def logon_account(service_name)\n      open_service(service_name, SC_MANAGER_CONNECT, SERVICE_QUERY_CONFIG) do |service|\n        query_config(service) do |config|\n          return config[:lpServiceStartName].read_arbitrary_wide_string_up_to(Puppet::Util::Windows::ADSI::User::MAX_USERNAME_LENGTH)\n        end\n      end\n    end","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/util/windows/service.rb#L124-L160","documentation":"Raised by service_start_type when the dwStartType from QueryServiceConfigW has no entry in SERVICE_START_TYPES (which maps all five standard values 0-4: boot, system, auto, demand, disabled). As with the state error, the interpolated start_type is nil so the message always prints an empty value, which makes diagnosis confusing. A genuine hit means the SCM returned an out-of-range start type.","triggerScenarios":"service_start_type on a driver service whose configuration reports a start type outside 0-4, or corrupted QUERY_SERVICE_CONFIGW data read through FFI. The delayed-autostart probe only runs when the type is SERVICE_AUTO_START, so it cannot rescue this.","commonSituations":"Querying newly installed or mid-removal services; kernel/boot driver services with unusual configurations; FFI struct layout mismatches after Ruby/ffi upgrades.","solutions":["Check the raw configuration with sc qc <name> to see the actual START_TYPE","Retry once after a delay if the service was just installed or modified","Verify ffi gem / Puppet compatibility if multiple services show this","Report upstream with the service name and sc qc output"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  Puppet::Util::Windows::Service.service_start_type(name)\nrescue Puppet::Error => e\n  retry if (tries -= 1) > 0 && e.message.include?('Unknown start type')\n  raise Puppet::Error, \"Check raw config: sc qc #{name}\"\nend","preventionTips":["Query freshly installed services once more after a short delay","Verify with sc qc when it reproduces; suspect ffi layout drift if it affects many services"],"tags":["windows","service","win32","startup-type","scm"],"backgroundTag":"unknown-service-start-type","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}