# curl errors: codes 6, 7, 22, 28, 35, 60 and how to fix them

Source: https://checkcraft.ru/en/guides/curl-errors.html · updated 2026-12-02

What curl errors mean: Could not resolve host (6), Failed to connect (7), The requested URL returned error (22), Operation timed out (28)…

Practical workflow

Checkcraft is a desktop app for checking APIs and logs without code, with a free edition. [Download, no sign-up →](https://checkcraft.ru/en/download-checkcraft.html#free-download)

A numbered curl error almost always means the request never reached the application or the response never came back: a DNS, network, proxy or certificate problem. An API error looks different — an HTTP 4xx or 5xx in the response. Below is a code table, common causes and commands that quickly show where it breaks.

Checkcraft · 2 December 2026

Get help with your first test →

## curl error or API error

If curl prints curl: (number) and a message, the connection failed or broke. If a response with 401, 404 or 500 arrived, the network works and the application returned the error. The -f flag turns HTTP errors into exit code 22, so in scripts remember that 22 already means a server response.

## curl: (22) The requested URL returned error: 404, 500, 618

Code 22 only happens with -f (--fail): the server answered, and curl turned its HTTP status of 400 or higher into an error. The number after the colon is the server status code. Standard codes range from 100 to 599, but gateways and applications sometimes send their own, such as 618 or 999: then only that service knows what the number means, so check its docs or log. To see what the server wrote in the response body, replace -f with --fail-with-body (curl 7.76 or newer) or run the request with -v.

Repeating checks like this by hand? Checkcraft saves them and reruns them in one click. [Download Free →](https://checkcraft.ru/en/download-checkcraft.html#free-download)

## How to find where it breaks

Run the same request with -v: you see which IP the name resolved to, whether the connection succeeded, how the TLS handshake went and what the server answered. An error before the Connected line is network or DNS, between it and the response is TLS or proxy, after the response is the application.

## Do not disable certificate checks for good

The -k flag removes error 60 but also the protection against a spoofed server. Fine for one-off diagnostics, not for scripts and autotests: point to the right root certificate with --cacert or install it in the system.

## curl error codes

| Code | Message | Usually means |
|---|---|---|
| 6 | Could not resolve host | The host name did not resolve: typo, no DNS, VPN needed |
| 7 | Failed to connect | The server refuses the connection: wrong port, service down, firewall |
| 22 | The requested URL returned error | With -f the server returned HTTP 400 or higher |
| 28 | Operation timed out | No connection or response in time: network, proxy, slow server |
| 35 | SSL connect error | TLS handshake failed: TLS version, intercepting proxy, old curl |
| 52 | Empty reply from server | The server closed without answering: crashed process, HTTP on an HTTPS port |
| 56 | Failure when receiving data | The connection broke during the response |
| 60 | SSL certificate problem | Certificate failed verification: self-signed, missing intermediate |

## Diagnostic commands

```
# подробный вывод: DNS, подключение, TLS, заголовки
curl -v https://api.example.com/health

# только код ответа и время по этапам
curl -s -o /dev/null -w "code=%{http_code} dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} total=%{time_total}\n" https://api.example.com/health

# таймауты: 5 секунд на подключение, 30 на весь запрос
curl --connect-timeout 5 --max-time 30 https://api.example.com/orders

# свой корневой сертификат вместо -k
curl --cacert ./corp-root.pem https://api.internal.example/health
```

A long time to connect points to network or proxy. A long total alone means the server responds slowly, which is an application question.

## Common situations

- Works in the browser, error 60 in curl. The browser knows the corporate root certificate and curl does not: pass it with --cacert.
- Error 7 on localhost. The service listens on another port or only IPv6; try 127.0.0.1 instead of localhost.
- Error 28 via VPN or proxy. Set the proxy with -x or check https_proxy and no_proxy.
- Error 52. Usually the server process crashed on the request: read its log.

When the connection works and an HTTP error code arrives, see [error 401](https://checkcraft.ru/en/guides/api-401-error.html) and [error 500](https://checkcraft.ru/en/guides/api-500-error.html).

## More on curl

Section overview and all guides: [curl command cheat sheet: flags and examples for APIs](https://checkcraft.ru/en/guides/curl-cheat-sheet.html).

- [curl on Windows and PowerShell: how to run it and why commands fail](https://checkcraft.ru/en/guides/curl-windows-powershell.html)
- [Download a file with curl: -o, -O, redirects and resume](https://checkcraft.ru/en/guides/curl-download-file.html)
- [curl through a proxy: -x, environment variables, SOCKS and no_proxy](https://checkcraft.ru/en/guides/curl-proxy.html)
- [PHP cURL: GET and POST requests with JSON, headers and error handling](https://checkcraft.ru/en/guides/php-curl.html)
- [Webhook: what it is, how it works and how to test it](https://checkcraft.ru/en/guides/webhook-testing.html)

Next step

## Repeat this on your own API

Checkcraft is a desktop app that saves API response checks without code and shows what did not match. Start with a sample, then use your own sanitized data. Free runs on Windows and Linux with no time limit.

[Download Free](https://checkcraft.ru/en/download-checkcraft.html#free-download) · [Download and first run](https://checkcraft.ru/en/download-checkcraft.html)

No sign-up or email needed, the archive is ready in a couple of minutes. See the [edition limits](https://checkcraft.ru/en/pricing.html).

## References

[curl man page and exit codes](https://curl.se/docs/manpage.html)

## Continue with a related task

[cURL examples: GET and POST requests with JSON on Linux, Windows and PowerShell](https://checkcraft.ru/en/guides/curl-post-json.html) · [curl with authorization: Bearer token, Basic, API key and headers](https://checkcraft.ru/en/guides/curl-authorization-header.html) · [curl on Windows and PowerShell: how to run it and why commands fail](https://checkcraft.ru/en/guides/curl-windows-powershell.html) · [401 Unauthorized in an API and Postman: why access is denied](https://checkcraft.ru/en/guides/api-401-error.html) · [API error 500: server problem or bad request](https://checkcraft.ru/en/guides/api-500-error.html)

Start with the linked example and compare its result with your own test requirement.

Ask a person

## Get help with your first test

Tell us what you want to test or where you got stuck. We can help you start Checkcraft, choose an example and understand your first run. You can ask before downloading.

[Ask in Telegram](https://t.me/checkcraftchat)Send an email

The Telegram group is public: do not post passwords, tokens or confidential work data. A description of your task is enough to start.

You can also email us support@checkcraft.ru

Page card: /ai/pages/en/guides/curl-errors.md
