puppetlabs/puppet · error · ArgumentError
Unknown service #{name}
Error message
Unknown service #{name} What it means
Puppet::HTTP::Service.create is the factory behind session.create_service and supports exactly five service names: :ca, :fileserver, :puppet (the compiler), :puppetserver, and :report. Any other value raises ArgumentError. Because the dispatch case-matches Symbols, passing a String like 'ca' also falls through to the error.
Source
Thrown at lib/puppet/http/service.rb:47
# @param [<Type>] port optional, the port to connect to
#
# @return [Puppet::HTTP::Service] an instance of the service type requested
#
# @api private
def self.create_service(client, session, name, server = nil, port = nil)
case name
when :ca
Puppet::HTTP::Service::Ca.new(client, session, server, port)
when :fileserver
Puppet::HTTP::Service::FileServer.new(client, session, server, port)
when :puppet
::Puppet::HTTP::Service::Compiler.new(client, session, server, port)
when :puppetserver
::Puppet::HTTP::Service::Puppetserver.new(client, session, server, port)
when :report
Puppet::HTTP::Service::Report.new(client, session, server, port)
else
raise ArgumentError, "Unknown service #{name}"
end
end
# Check if the service named is included in the list of available services.
#
# @param [Symbol] name
#
# @return [Boolean]
#
# @api private
def self.valid_name?(name)
SERVICE_NAMES.include?(name)
end
# Create a new service. Services should be created by calling `Puppet::HTTP::Session#route_to`.
#
# @param [Puppet::HTTP::Client] client
# @param [Puppet::HTTP::Session] sessionView on GitHub (pinned to e227c27540)
Solutions
- Use one of the supported Symbols: :ca, :fileserver, :puppet, :puppetserver, :report.
- Validate first with Puppet::HTTP::Service.valid_name?(name) or check Puppet::HTTP::Service::SERVICE_NAMES.
- For PuppetDB, use the puppetdb-ruby / pdbclient libraries, not this factory.
Example fix
# before
service = session.create_service('puppetdb')
# after
raise ArgumentError, name unless Puppet::HTTP::Service.valid_name?(name.to_sym)
service = session.create_service(name.to_sym) Defensive patterns
Strategy: type-guard
Validate before calling
name = name.to_sym
raise ArgumentError, "unknown service #{name}" unless Puppet::HTTP::Service.valid_name?(name)
service = session.create_service(name) Type guard
valid_service = ->(n) { Puppet::HTTP::Service::SERVICE_NAMES.include?(n.to_sym) }
raise ArgumentError, n unless valid_service.call(name) Prevention
- Only :ca, :fileserver, :puppet, :puppetserver, :report exist — always pass Symbols.
- Convert config-sourced names with .to_sym and validate before creating the service.
When it happens
Trigger: session.create_service(:puppetdb), :status, or a typo like :reports; create_service('ca') with a String; dynamically built names from config that arrive as Strings.
Common situations: Porting from the pre-6.x Puppet::Network::HttpPool/indirection APIs and guessing the new service name; attempting PuppetDB access through puppet's HTTP session instead of the puppetdb client; name-to-symbol conversion missing when service names come from YAML config.
Related errors
- Unable to verify the SSL certificate at %{uri}
- Please provide a file or checksum to diff with
- Failed to diff files
- Unsupported translation file format #{file_format}; please u
- 'put' requires a string 'body' argument
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/7294d5c7c99dfe21.
Report an issue: GitHub.