{"record":{"id":"69b571982d63532e","repo":"coollabsio/coolify","slug":"failed-to-process-certificate","errorCode":null,"errorMessage":"Failed to process certificate.","messagePattern":"Failed to process certificate\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"app/Livewire/Server/CaCertificate/Show.php","lineNumber":69,"sourceCode":"    {\n        $this->showCertificate = ! $this->showCertificate;\n    }\n\n    public function saveCaCertificate()\n    {\n        try {\n            $this->authorize('manageCaCertificate', $this->server);\n            if (! $this->certificateContent) {\n                throw new \\Exception('Certificate content cannot be empty.');\n            }\n\n            $parsedCert = openssl_x509_read($this->certificateContent);\n            if (! $parsedCert) {\n                throw new \\Exception('Invalid certificate format.');\n            }\n\n            if (! openssl_x509_export($parsedCert, $cleanedCertificate)) {\n                throw new \\Exception('Failed to process certificate.');\n            }\n            $this->certificateContent = $cleanedCertificate;\n\n            if ($this->caCertificate) {\n                $this->caCertificate->ssl_certificate = $this->certificateContent;\n                $this->caCertificate->save();\n\n                $this->loadCaCertificate();\n\n                $this->writeCertificateToServer();\n\n                dispatch(new RegenerateSslCertJob(\n                    server_id: $this->server->id,\n                    force_regeneration: true\n                ));\n            }\n            $this->dispatch('success', 'CA Certificate saved successfully.');\n        } catch (\\Throwable $e) {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Livewire/Server/CaCertificate/Show.php#L51-L87","documentation":"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.","triggerScenarios":"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.","commonSituations":"After a PHP/OpenSSL package upgrade on the host; importing certificates from uncommon CAs or appliances; low memory_limit configurations.","solutions":["Re-export the certificate on your workstation (openssl x509 -in cert.pem -outform PEM) and paste the freshly normalized PEM","Check PHP error log for OpenSSL warnings and memory exhaustion at the time of the failure","Verify PHP OpenSSL support: php -i | grep OpenSSL, and confirm extension version consistency after upgrades","Raise memory_limit if the log shows exhaustion, then retry the save"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"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.","preventionTips":["Normalize PEMs offline first: openssl x509 -in cert.pem -outform PEM","Keep PHP/OpenSSL versions consistent after system upgrades","Watch memory_limit when importing unusually large certificate material"],"tags":["certificate","openssl","x509","export"],"backgroundTag":"x509-certificate-export-failed","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}