coollabsio/coolify · error · RuntimeException
SSL Certificate generation failed: {$e->getMessage()}
Error message
SSL Certificate generation failed: {$e->getMessage()} What it means
This is the catch-all wrapper at the end of SslHelper::generateSslCertificate(): any Throwable thrown inside the method (private key generation/export, CSR creation, signing, cert export, temp-file handling) is rethrown as a RuntimeException prefixed 'SSL Certificate generation failed:'. The suffix is the underlying exception message — that is the real error to diagnose.
Source
Thrown at app/Helpers/SslHelper.php:228
'resource_type' => $resourceType,
'resource_id' => $resourceId,
]);
$model->fileStorages()->create([
'fs_path' => $configurationDir.'/ssl/server.key',
'mount_path' => $mountPath.'/server.key',
'content' => $privateKeyStr,
'is_directory' => false,
'chmod' => '600',
'resource_type' => $resourceType,
'resource_id' => $resourceId,
]);
}
}
return $sslCertificate;
} catch (\Throwable $e) {
throw new \RuntimeException('SSL Certificate generation failed: '.$e->getMessage(), 0, $e);
} finally {
fclose($tempConfig);
}
}
}
View on GitHub (pinned to 70b9acc424)
Solutions
- Read the text after 'SSL Certificate generation failed:' — it names the exact failing step (key, CSR, signing, export) and the OpenSSL error string.
- Fix the underlying cause using the guidance for that inner error (extension/config/CA pair).
- Verify environment basics: OpenSSL extension loaded, openssl.cnf readable, /tmp writable, disk space available.
Example fix
// before: only the wrapper message surfaces
try {
SslHelper::generateSslCertificate($commonName);
} catch (\RuntimeException $e) {
log($e->getMessage()); // 'SSL Certificate generation failed: Failed to generate CSR: ...'
}
// after: log the previous exception chain for the real cause
catch (\RuntimeException $e) {
while ($e) {
log($e->getMessage());
$e = $e->getPrevious();
}
} Defensive patterns
Strategy: try-catch
Try / catch
try {
$cert = SslHelper::generateSslCertificate($commonName, $sans);
} catch (\RuntimeException $e) {
// unwrap the chain: the innermost message is the real cause
$cause = $e;
while ($cause->getPrevious()) {
$cause = $cause->getPrevious();
}
report("SSL generation failed: {$cause->getMessage()}");
return null; // fall back to existing certificate if present
} Prevention
- Always inspect getPrevious() — the wrapper message alone hides the failing step.
- Run an OpenSSL capability smoke test (key new/export) during deploy or install, not at first certificate request.
- Keep existing SslCertificate rows valid until the replacement is successfully generated.
When it happens
Trigger: Any failure during certificate issuance: the OpenSSL key/CSR/sign/export errors from this helper, temp config file write failures, or SslCertificate model persistence errors. Triggered whenever Coolify generates certificates for resources (e.g. enabling SSL on a service/app).
Common situations: Misconfigured OpenSSL in the PHP runtime (see the specific inner errors); full disk preventing temp config creation; invalid CA inputs when issuing CA-signed certificates.
Understand the failure class
- SSL/TLS and certificate errors — how TLS handshakes and certificate validation fail.
Related errors
- Failed to generate private key: {openssl_error_string()}
- Failed to export private key: {openssl_error_string()}
- Failed to generate CSR: {openssl_error_string()}
- Failed to sign certificate: {openssl_error_string()}
- Failed to export certificate: {openssl_error_string()}
AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17).
Data as JSON: /api/errors/7305b0cf864ecc99.
Report an issue: GitHub.