Skip to content
Latchkey

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.

Terminal
curl: (77) error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none

Common 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

  1. Install ca-certificates so the default bundle exists.
  2. Check the exact CAfile printed in the error and confirm it is present and readable.
  3. Re-run the request.
Terminal
sudo apt-get update && sudo apt-get install -y ca-certificates
sudo update-ca-certificates
ls -l /etc/ssl/certs/ca-certificates.crt

Point 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.

Terminal
export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
curl https://example.com

How to prevent it

  • Ensure ca-certificates is installed before any step that overrides the CA path.
  • Keep CURL_CA_BUNDLE / SSL_CERT_FILE pointing at files that actually exist on the image.
  • Validate custom CA paths in a setup step so the failure is obvious.

Frequently asked questions

What causes ""curl: (77) error setting certificate verify locations""?
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.
How do I fix "curl: (77) error setting certificate verify locations"?
Create the CA bundle the path expects

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card