coollabsio/coolify · error · Exception

Failed to process certificate.

Error message

Failed to process certificate.

What it means

The certificate parsed successfully (openssl_x509_read returned a resource) but openssl_x509_export() returned false when re-encoding it to normalized PEM. This is rare: export of a just-parsed certificate seldom fails, and usually points to an OpenSSL library issue, memory limits, or an exotic/malformed certificate structure that parses but cannot be serialized.

Source

Thrown at app/Livewire/Server/CaCertificate/Show.php:69

    {
        $this->showCertificate = ! $this->showCertificate;
    }

    public function saveCaCertificate()
    {
        try {
            $this->authorize('manageCaCertificate', $this->server);
            if (! $this->certificateContent) {
                throw new \Exception('Certificate content cannot be empty.');
            }

            $parsedCert = openssl_x509_read($this->certificateContent);
            if (! $parsedCert) {
                throw new \Exception('Invalid certificate format.');
            }

            if (! openssl_x509_export($parsedCert, $cleanedCertificate)) {
                throw new \Exception('Failed to process certificate.');
            }
            $this->certificateContent = $cleanedCertificate;

            if ($this->caCertificate) {
                $this->caCertificate->ssl_certificate = $this->certificateContent;
                $this->caCertificate->save();

                $this->loadCaCertificate();

                $this->writeCertificateToServer();

                dispatch(new RegenerateSslCertJob(
                    server_id: $this->server->id,
                    force_regeneration: true
                ));
            }
            $this->dispatch('success', 'CA Certificate saved successfully.');
        } catch (\Throwable $e) {

View on GitHub (pinned to 70b9acc424)

Solutions

  1. Re-export the certificate on your workstation (openssl x509 -in cert.pem -outform PEM) and paste the freshly normalized PEM
  2. Check PHP error log for OpenSSL warnings and memory exhaustion at the time of the failure
  3. Verify PHP OpenSSL support: php -i | grep OpenSSL, and confirm extension version consistency after upgrades
  4. Raise memory_limit if the log shows exhaustion, then retry the save
Defensive patterns

Strategy: try-catch

Try / catch

Wrap the parse/export pair in one try/catch (Throwable); on export failure keep the submitted (parsed) content unmodified, dispatch('error', ...), and inspect PHP error logs for the underlying OpenSSL warning instead of retrying blindly.

Prevention

When it happens

Trigger: Unusual certificate encodings or corrupt base64 that still skims through the parser; PHP OpenSSL extension/version mismatches after an upgrade; memory_limit exhaustion during export of very large chains.

Common situations: After a PHP/OpenSSL package upgrade on the host; importing certificates from uncommon CAs or appliances; low memory_limit configurations.

Understand the failure class

Related errors


AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17). Data as JSON: /api/errors/69b571982d63532e. Report an issue: GitHub.