curl "(77) error setting certificate verify locations" in CI
Error 77 is a configuration problem, not a trust problem: curl was pointed at a CA file or directory (via --cacert, --capath, CURL_CA_BUNDLE, or a compiled-in default) that is missing or unreadable. It fails before contacting the server. The fix is to make the path point at a real, readable bundle.
What this error means
curl fails immediately with "curl: (77) error setting certificate verify locations:" and prints the CAfile and CApath it tried to use.
curl: (77) error setting certificate verify locations:
CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: noneCommon causes
The configured CA bundle path does not exist
A slim image lacks /etc/ssl/certs/ca-certificates.crt, or CURL_CA_BUNDLE / --cacert points at a file that was never created on the runner.
The CA file or directory is unreadable
The referenced bundle exists but the step's user cannot read it, so curl cannot load verify locations.
How to fix it
Create the CA bundle the path expects
- Install
ca-certificatesso the default bundle exists. - Check the exact CAfile printed in the error and confirm it is present and readable.
- Re-run the request.
sudo apt-get update && sudo apt-get install -y ca-certificates
sudo update-ca-certificates
ls -l /etc/ssl/certs/ca-certificates.crtPoint the env var at a real bundle
If a CURL_CA_BUNDLE or SSL_CERT_FILE value is stale, set it to an existing readable file or unset it to use the default.
export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
curl https://example.comHow to prevent it
- Ensure
ca-certificatesis installed before any step that overrides the CA path. - Keep
CURL_CA_BUNDLE/SSL_CERT_FILEpointing at files that actually exist on the image. - Validate custom CA paths in a setup step so the failure is obvious.