{"record":{"id":"28554bb39fc9be64","repo":"puppetlabs/puppet","slug":"failed-to-add-path-as-a-trusted-ca-file-de","errorCode":null,"errorMessage":"Failed to add '%{path}' as a trusted CA file: %{detail}","messagePattern":"Failed to add '%(.+?)' as a trusted CA file: %(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/puppet/ssl/ssl_provider.rb","lineNumber":87,"sourceCode":"  # @param include_client_cert [true, false] If true, the client cert will be added to the context\n  #   allowing mutual TLS authentication. The default is false. If the client cert doesn't exist\n  #   then the option will be ignored.\n  # @return [Puppet::SSL::SSLContext] A context to use to create connections\n  # @raise (see #create_context)\n  # @api private\n  def create_system_context(cacerts:, path: Puppet[:ssl_trust_store], include_client_cert: false)\n    store = create_x509_store(cacerts, [], false, include_system_store: true)\n\n    if path\n      stat = Puppet::FileSystem.stat(path)\n      if stat\n        if stat.ftype == 'file'\n          # don't add empty files as ruby/openssl will raise\n          if stat.size > 0\n            begin\n              store.add_file(path)\n            rescue => e\n              Puppet.err(_(\"Failed to add '%{path}' as a trusted CA file: %{detail}\" % { path: path, detail: e.message }, e))\n            end\n          end\n        else\n          Puppet.warning(_(\"The 'ssl_trust_store' setting does not refer to a file and will be ignored: '%{path}'\" % { path: path }))\n        end\n      end\n    end\n\n    if include_client_cert\n      cert_provider = Puppet::X509::CertProvider.new\n      private_key = cert_provider.load_private_key(Puppet[:certname], required: false)\n      unless private_key\n        Puppet.warning(\"Private key for '#{Puppet[:certname]}' does not exist\")\n      end\n\n      client_cert = cert_provider.load_client_cert(Puppet[:certname], required: false)\n      unless client_cert\n        Puppet.warning(\"Client certificate for '#{Puppet[:certname]}' does not exist\")","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/ssl/ssl_provider.rb#L69-L105","documentation":"Error \"Failed to add '%{path}' as a trusted CA file: %{detail}\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/ssl/ssl_provider.rb:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}