Skip to content
Latchkey

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

Run this faster and cheaper on Latchkey managed runners. Start free →