puppetlabs/puppet · error · Puppet::HTTP::ProtocolError
Content-Type is unsupported
Error message
Content-Type is unsupported
What it means
After resolving a formatter from Content-Type, Puppet::HTTP::Service rejects formats that are excluded from network use: EXCLUDED_FORMATS = [:yaml, :b64_zlib_yaml, :dot] (service.rb:15). Those renderers exist only for local CLI output, so a response advertising e.g. text/yaml or the b64_zlib_yaml/dot mimes raises Puppet::HTTP::ProtocolError — puppet's HTTP services only negotiate pson/json (and msgpack when enabled).
Source
Thrown at lib/puppet/http/service.rb:137
def build_url(api, server, port)
URI::HTTPS.build(host: server,
port: port,
path: api).freeze
end
def get_mime_types(model)
network_formats = model.supported_formats - EXCLUDED_FORMATS
network_formats.map { |f| model.get_format(f).mime }
end
def formatter_for_response(response)
header = response['Content-Type']
raise Puppet::HTTP::ProtocolError, _("No content type in http response; cannot parse") unless header
header.gsub!(/\s*;.*$/, '') # strip any charset
formatter = Puppet::Network::FormatHandler.mime(header)
raise Puppet::HTTP::ProtocolError, "Content-Type is unsupported" if EXCLUDED_FORMATS.include?(formatter.name)
formatter
end
def serialize(formatter, object)
formatter.render(object)
rescue => err
raise Puppet::HTTP::SerializationError.new("Failed to serialize #{object.class} to #{formatter.name}: #{err.message}", err)
end
def serialize_multiple(formatter, object)
formatter.render_multiple(object)
rescue => err
raise Puppet::HTTP::SerializationError.new("Failed to serialize multiple #{object.class} to #{formatter.name}: #{err.message}", err)
end
def deserialize(response, model)
formatter = formatter_for_response(response)View on GitHub (pinned to e227c27540)
Solutions
- Set both agent and server to a network-supported format (pson/json, or msgpack via the proper setting) and remove yaml from route format lists.
- Remove any proxy rule that rewrites response Content-Type.
- Align agent and server versions so format negotiation matches.
Example fix
# puppetserver conf (route) - before provides: [yaml, pson] # after - yaml is not a network format provides: [pson, json]
Defensive patterns
Strategy: try-catch
Try / catch
begin
service.get_facts(name)
rescue Puppet::HTTP::ProtocolError => e
raise unless e.message.include?('Content-Type is unsupported')
# server advertised yaml/b64_zlib_yaml/dot — fix route format negotiation
raise
end Prevention
- Never advertise yaml, b64_zlib_yaml, or dot as network formats on puppetserver routes.
- Keep preferred_serialization_format consistent (pson/json, or msgpack deliberately enabled).
- Align agent and server versions so format negotiation cannot skew.
When it happens
Trigger: A server responds with a Content-Type that FormatHandler maps to :yaml, :b64_zlib_yaml, or :dot — e.g. someone force-enabling YAML serialization on puppetserver routes, or a proxy rewriting Content-Type; version/feature skew where one side negotiates a format the other never accepts over HTTP.
Common situations: Operators configuring preferred_serialization_format or format whitelists to yaml thinking it is network-safe; middleboxes 'normalizing' application/json to text/yaml; mismatched agent/server pairs after a partial upgrade.
Related errors
- No content type in http response; cannot parse
- 'put' requires a 'content-type' header
- 'post' requires a 'content-type' header
- Location response header is missing
- Failed to parse Retry-After header '%{retry_after}' as an in
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/2307c336f884dec3.
Report an issue: GitHub.