curl: (77) error setting certificate verify locations
curl can't read its CA certificate bundle
Seen in curl, libcurl (CURLE_SSL_CACERT_BADFILE), PHP, Git
curl could not load the CA certificate file or directory it was told to use, so it cannot verify any server.
Common causes
- The CA bundle is not installed, common in minimal container images.
- CURL_CA_BUNDLE, SSL_CERT_FILE, --cacert or a .curlrc points to a file that does not exist.
- The file exists but is unreadable by the user running curl, or is not in PEM format.
How to fix it
- Install the CA bundle: apt-get install ca-certificates, or apk add ca-certificates.
- Check the path printed after "CAfile:" exists and is readable, and fix or unset the variable that sets it.
- Point --cacert at a valid PEM bundle, for example one downloaded from curl.se/docs/caextract.html.
Got a different message? Paste it into the error explainer.
Related errors
- curl: (3) URL using bad/illegal format or missing URL · curl could not parse the URL
- unexpected eof while reading · The peer closed the connection without a TLS close
- Error: write EPIPE · Wrote to a connection the other side had closed
- TypeError: fetch failed · Node.js fetch failed below HTTP
- Error: listen EADDRINUSE: address already in use · Another process is already using the port
- Error: EMFILE: too many open files · The process ran out of file descriptors
- unable to get local issuer certificate · The client can't find the certificate's issuer
- unable to verify the first certificate · The intermediate certificate is missing
- certificate has expired · The server certificate has expired
- self signed certificate in certificate chain · The chain ends in an untrusted root
- wrong version number · TLS spoken to something that isn't TLS
- curl: (6) Could not resolve host · The hostname doesn't resolve