curl: (3) URL using bad/illegal format or missing URL
curl could not parse the URL
Seen in curl, libcurl (CURLE_URL_MALFORMAT), PHP and other libcurl bindings
curl rejected the URL before connecting because it is empty, malformed or contains characters it cannot use.
Common causes
- Spaces, smart quotes or stray characters in the URL, often from copying out of a document or chat.
- Shell quoting problems, such as Windows cmd not treating single quotes as quotes, so they end up in the URL.
- Unescaped [ ] or { } in the URL, which curl treats as globbing ranges.
- A variable in a script expanded to an empty string, so no URL was passed at all.
How to fix it
- Wrap the URL in double quotes and retype any curly quotes as straight ones.
- Percent-encode spaces (%20) and other special characters in the path and query.
- Use -g (--globoff) when the URL legitimately contains [ ] or { }.
- Echo the variable before the curl call to check it holds a full URL with a scheme.
Got a different message? Paste it into the error explainer.
Related errors
- curl: (77) error setting certificate verify locations · curl can't read its CA certificate bundle
- 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