{"record":{"id":"a276e26a30a30cf1","repo":"puppetlabs/puppet","slug":"unknown-service-name-a276e2","errorCode":null,"errorMessage":"Unknown service #{name}","messagePattern":"Unknown service #(.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/http/session.rb","lineNumber":52,"sourceCode":"  # configuration file, this method always returns a Service with that host and\n  # port. Otherwise, we walk the list of resolvers in priority order:\n  #     - DNS SRV\n  #     - Server List\n  #     - Puppet server/port settings\n  # If a given resolver fails to connect, it tries the next available resolver\n  # until a successful connection is found and returned. The successful service\n  # is cached and returned if `route_to` is called again.\n  #\n  # @param [Symbol] name the service to resolve\n  # @param [URI] url optional explicit url to use, if it is already known\n  # @param [Puppet::SSL::SSLContext] ssl_context ssl context to be\n  #   used for connections\n  #\n  # @return [Puppet::HTTP::Service] the resolved service\n  #\n  # @api public\n  def route_to(name, url: nil, ssl_context: nil)\n    raise ArgumentError, \"Unknown service #{name}\" unless Puppet::HTTP::Service.valid_name?(name)\n\n    # short circuit if explicit URL host & port given\n    if url && !url.host.nil? && !url.host.empty?\n      service = Puppet::HTTP::Service.create_service(@client, self, name, url.host, url.port)\n      service.connect(ssl_context: ssl_context)\n      return service\n    end\n\n    cached = @resolved_services[name]\n    return cached if cached\n\n    canceled = false\n    canceled_handler = ->(cancel) { canceled = cancel }\n\n    @resolvers.each do |resolver|\n      Puppet.debug(\"Resolving service '#{name}' using #{resolver.class}\")\n      service = resolver.resolve(self, name, ssl_context: ssl_context, canceled_handler: canceled_handler)\n      if service","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/http/session.rb#L34-L70","documentation":"Puppet::HTTP::Session#route_to resolves a named service; the name must be one of the frozen SERVICE_NAMES list (:ca, :fileserver, :puppet, :puppetserver, :report). Anything else — including Strings instead of Symbols, or legacy indirection names like :catalog or :facts — raises ArgumentError because no such routable service exists.","triggerScenarios":"session.route_to('puppet') with a String instead of a Symbol; session.route_to(:catalog) or :facts — catalog and facts are indirections served by the :puppet service, not service names; typos like :reports.","commonSituations":"Migrating from the old Puppet::Network::HTTP connection API where any REST endpoint was reachable; assuming every indirection name is routable; passing a name read from config or templates that arrives as a String.","solutions":["Use one of :ca, :fileserver, :puppet, :puppetserver, :report — catalog/facts/node requests go through route_to(:puppet)","Convert to a Symbol with name.to_sym before calling","Guard with Puppet::HTTP::Service.valid_name?(name) when the name comes from external input"],"exampleFix":"# before (ruby)\nservice = session.route_to(:catalog)   # => ArgumentError: Unknown service catalog\n\n# after\nservice = session.route_to(:puppet)\nservice.post_catalog(...)  # catalog is a method on the puppet service","handlingStrategy":"validation","validationCode":"# ruby\nraise ArgumentError, \"unroutable service #{name}\" unless Puppet::HTTP::Service.valid_name?(name)\nservice = session.route_to(name)","typeGuard":"def routable_service?(name)\n  Puppet::HTTP::Service.valid_name?(name)  # :ca :fileserver :puppet :puppetserver :report\nend","tryCatchPattern":"begin\n  session.route_to(name)\nrescue ArgumentError\n  name = :puppet  # catalog/facts/node live under :puppet\n  retry\nend","preventionTips":["Use Symbols from the fixed SERVICE_NAMES list; never derive service names from indirection names","Call Puppet::HTTP::Service.valid_name? before route_to when names are dynamic","Remember :catalog and :facts are method calls on the :puppet service, not routable names"],"tags":["puppet-http","session","service-routing","argument-validation"],"backgroundTag":"unknown-service-name","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}