puppetlabs/puppet · error

Failed to add ' ' as a trusted CA file

Error message

Failed to add '%{path}' as a trusted CA file: %{detail}

What it means

Raised in SSLProvider#create_system_context when the configured trust store path (Puppet[:ssl_trust_store]) fails to be loaded: the file cannot be read or its certificates cannot be added to the X509 store, and the underlying error is reported as detail. It means the extra trusted-CA file is unusable, so the SSL context cannot include it.

Solutions

  1. Verify the ssl_trust_store path exists and is readable by the Puppet user
  2. Ensure the file contains valid PEM-encoded CA certificates
  3. Fix file permissions or point ssl_trust_store at a valid CA bundle
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/puppet/ssl/ssl_provider.rb:87 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at lib/puppet/ssl/ssl_provider.rb:87

  # @param include_client_cert [true, false] If true, the client cert will be added to the context
  #   allowing mutual TLS authentication. The default is false. If the client cert doesn't exist
  #   then the option will be ignored.
  # @return [Puppet::SSL::SSLContext] A context to use to create connections
  # @raise (see #create_context)
  # @api private
  def create_system_context(cacerts:, path: Puppet[:ssl_trust_store], include_client_cert: false)
    store = create_x509_store(cacerts, [], false, include_system_store: true)

    if path
      stat = Puppet::FileSystem.stat(path)
      if stat
        if stat.ftype == 'file'
          # don't add empty files as ruby/openssl will raise
          if stat.size > 0
            begin
              store.add_file(path)
            rescue => e
              Puppet.err(_("Failed to add '%{path}' as a trusted CA file: %{detail}" % { path: path, detail: e.message }, e))
            end
          end
        else
          Puppet.warning(_("The 'ssl_trust_store' setting does not refer to a file and will be ignored: '%{path}'" % { path: path }))
        end
      end
    end

    if include_client_cert
      cert_provider = Puppet::X509::CertProvider.new
      private_key = cert_provider.load_private_key(Puppet[:certname], required: false)
      unless private_key
        Puppet.warning("Private key for '#{Puppet[:certname]}' does not exist")
      end

      client_cert = cert_provider.load_client_cert(Puppet[:certname], required: false)
      unless client_cert
        Puppet.warning("Client certificate for '#{Puppet[:certname]}' does not exist")

View on GitHub (pinned to e227c27540)