curl Exit Code 22 in CI: HTTP Error with --fail
curl exit code 22 means the HTTP server returned an error status (>= 400) and curl was run with --fail (or -f).
A step exiting 22 from curl connected successfully but the server answered with a 4xx/5xx, and --fail turned that into a non-zero exit.
What it means
Exit 22 is curl's CURLE_HTTP_RETURNED_ERROR. With --fail, curl exits non-zero on HTTP >= 400 instead of printing the error body and exiting 0.
Common causes
- A 404 (wrong URL or missing resource).
- A 401/403 (auth/permissions).
- A 5xx from a struggling upstream.
How to fix it
Re-run without --fail (or add --show-error) to see the response body and exact status. Fix the URL, auth, or payload. A transient 5xx may clear on retry; a 4xx is a deterministic request error.
Related guides
Exit Codes and Signals in CI/CD: A Practical GuideA practical guide to process exit codes and signals in CI/CD - what 1, 2, 124, 126, 127, 130, 137, and 143 me…
CI Exit Code Lookup: What Does This Exit Code Mean?Instant lookup for CI/CD process exit codes - enter a code (137, 127, 143…) to see what it means, whether it…