puppetlabs/puppet · error · ArgumentError

URI protocol '%{protocol}' is not currently supported for fi

Error message

URI protocol '%{protocol}' is not currently supported for file serving

What it means

Puppet::FileServing::TerminusSelector#select maps the source URI scheme to an indirection terminus: file→:file, puppet→:rest (or default_file_terminus), http/https→:http, and no scheme→:file or :file_server depending on whether the key is an absolute path. Any other protocol reaches the else branch and raises ArgumentError because no terminus can serve it.

Source

Thrown at lib/puppet/file_serving/terminus_selector.rb:30

    case request.protocol
    when "file"
      :file
    when "puppet"
      if request.server
        :rest
      else
        Puppet[:default_file_terminus]
      end
    when "http", "https"
      :http
    when nil
      if Puppet::Util.absolute_path?(request.key)
        :file
      else
        :file_server
      end
    else
      raise ArgumentError, _("URI protocol '%{protocol}' is not currently supported for file serving") % { protocol: request.protocol }
    end
  end
end

View on GitHub (pinned to e227c27540)

Solutions

  1. Use a supported source form: `puppet:///modules/...` (file server), an absolute local path, or an http/https URL
  2. For other protocols, fetch out-of-band (an exec resource with curl/wget, or a package/archive module) and then reference the local file
  3. Mirror the content into a module or an HTTP endpoint Puppet can read

Example fix

# before (manifest)
file { '/opt/app.jar':
  source => 'ftp://srv.example.com/app.jar',
}

# after
file { '/opt/app.jar':
  source => 'https://srv.example.com/app.jar',
}
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = %w[file puppet http https].freeze

def servable_source?(uri)
  scheme = URI.parse(uri).scheme
  scheme.nil? ? Puppet::Util.absolute_path?(uri) : SUPPORTED.include?(scheme.downcase)
end

Type guard

# Narrow arbitrary source strings before handing them to file resources
def puppet_source?(s)
  s.is_a?(String) && (s.start_with?('puppet:///', 'file://') ||
    s.match?(%r{\Ahttps?://}) || Puppet::Util.absolute_path?(s))
end

Try / catch

begin
  Puppet::FileServing::TerminusSelector.select_terminus(request)
rescue ArgumentError => e
  raise unless e.message.include?('not currently supported for file serving')
  fail "download #{request.uri} out-of-band, then source the local copy"
end

Prevention

When it happens

Trigger: A file resource with `source => 'ftp://server/file'`, `rsync://...`, `s3://...`, or any scheme outside {file, puppet, http, https, nil}; also malformed sources that a URI parser still splits but with an unexpected scheme token.

Common situations: Assuming Puppet can fetch from arbitrary URL schemes; migrating manifests that used curl-style URLs; typos like `httpss://` or `puppets://`; copy-pasting artifact URLs from CI systems.

Related errors


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/e8fbcc7c86922ece. Report an issue: GitHub.