# Failure reasons

Each failed row in [`failed_downloads.jsonl`](<https://divyanshusingh96.github.io/machyon/reliability/failure-ledger/index.md>) has one of these reasons. Every reason has its own anchor, so you can link straight to it, for example [`#not-image`](<#not-image>).

**Retryable** reasons are retried automatically with backoff, then swept once more at the end of the run, and `machyon retry` tries them again later. **Permanent** reasons are never retried automatically, because a retry can't change the answer; `machyon retry --all` forces it anyway.

`http_404`serverpermanent

The server answered 404 Not Found: the image is gone.

**What to do:** The image no longer exists at that URL.

`http_410`serverpermanent

410 Gone: the server says the image was removed for good.

**What to do:** The resource has been permanently removed and is no longer available at this URL.

`http_403`serverpermanent

The server refused access (hotlink protection, login, bot check or a block).

**What to do:** The server refused access. Try --referer with the site's page URL, headers such as cookies, or slow down; you may be blocked or need to log in.

`http_401`serverpermanent

401 Unauthorized: the server wants a login or credentials before it answers.

**What to do:** Authentication is required. The resource may need a login or credentials, such as cookies or authorization headers.

`http_400`serverpermanent

400 Bad Request: the server rejected the URL or its query parameters.

**What to do:** The URL or its parameters were rejected by the server. Check the URL and the parameters it requires.

`http_4xx`serverpermanent

Any other 4xx except 408, 425 and 429, recorded as `http_<code>` (`http_418`, `http_451`, ...). Never retried.

**What to do:** The server rejected the request. Check the URL, access permissions, request headers and the server's requirements.

`http_429`serverretried automatically

Rate limited on every attempt. Each 429 also paused the whole host, honouring `Retry-After`.

**What to do:** Rate limited even after backing off. Re-run later or lower --max-concurrency.

`http_5xx`serverretried automatically

`http_500`, `http_502`, `http_503`, `http_504`, `http_520` to `http_524`: server errors that persisted through every retry.

**What to do:** Server error; it was retried. Re-run `machyon retry` later.

`http_408`serverretried automatically

Request timeout or `425 Too Early`, persisting through every retry.

**What to do:** The server timed out or asked to try again later; it was retried. Re-run `machyon retry` later.

`not_image`validationpermanent

The body isn't an image: an HTML error page, a login or bot-check page, or JSON. Never saved.

**What to do:** The server answered with something that isn't an image (an HTML error, login or bot-check page).

`timeout`networkretried automatically

No response within `timeout`, a stall longer than `timeout`, or an attempt longer than `max_request_time`.

**What to do:** The server was too slow. Raise --timeout, or lower --max-concurrency if your link is saturated.

`connection`networkretried automatically

Couldn't connect or the connection broke: DNS, firewall, proxy, or the server is down.

**What to do:** Could not connect (DNS, firewall, proxy or the server is down). Check your network / HTTPS\_PROXY.

`truncated`networkretried automatically

The connection dropped mid-body. Large bodies resume from where they stopped.

**What to do:** The connection dropped mid-download; it was retried.

`empty_body`networkretried automatically

The server answered 200 with an empty body.

`bad_range`networkretried automatically

A resume request got a range that didn't match the part file; the next attempt starts over.

`ssl_certificate`TLSpermanent

The server's certificate couldn't be verified. Retrying can't fix it; see `machyon doctor`.

**What to do:** The server's TLS certificate could not be verified, so nothing was downloaded. Usual causes: antivirus/firewall HTTPS scanning or a corporate proxy re-signing traffic, a wrong system clock, or an outdated CA store. Run `machyon doctor <url>` to see which trust source works. Last resort, for hosts you trust: --insecure.

`ssl`TLSretried automatically

The TLS handshake failed (reset or alert). Usually transient.

**What to do:** TLS handshake failed (connection reset or TLS alert). Usually transient; it was retried.

`too_many_redirects`networkpermanent

More than 10 redirects.

`invalid_url`inputpermanent

Not an `http://` or `https://` URL with a host.

`bad_name`inputpermanent

The filename couldn't be built for this row (for example, a template column is blank in this row).

`unsafe_name`inputpermanent

The filename would escape the save folder (`../`, an absolute path).

`duplicate_name`inputpermanent

Two different URLs would write the same file. The first keeps the name; the other row is recorded, never overwritten.

`write_error:<errno>`diskretried automatically

The file couldn't be written (permissions, a file locked by another program). Disk full, read-only or over quota stops the run instead: see FatalDiskError.

**What to do:** Could not write the file (permissions, file locked by another program, or disk problem).

`interrupted`runrun again to resume

The run stopped (Ctrl+C, cancellation, disk full) before this row finished. Running again resumes it.

`cancelled`runrun again to resume

An attempt was cancelled while in flight; retried.

`error:<Type>`bug guardretried automatically

An unexpected exception in one attempt. The worker survives and the row is recorded. Please report it.

HTTP statuses retried as transient: 408, 425, 429, 500, 502, 503, 504, 520, 521, 522, 523, 524.

## Exceptions

Two conditions stop a run instead of being recorded per row:

**[`FatalDiskError`](<https://divyanshusingh96.github.io/machyon/reference/python-api/index.md#machyon.FatalDiskError> "<code class=\"doc-symbol doc-symbol-heading doc-symbol-class\"></code>            <span class=\"doc doc-object-name doc-class-name\">FatalDiskError</span>")**

The disk is full, read-only or over quota. All workers stop, every row that was queued, waiting or in flight is recorded as `interrupted`, the ledger is written, and the error is raised. Free some space and run the same command again.

**`RuntimeError`**

`machyon.download()` was called inside a running event loop. Use `await machyon.adownload(...)`.

Mistakes in the call itself raise ordinary Python errors before anything is downloaded: `ValueError` for a template key that isn't a column, or when a list of names and a list of URLs have different lengths; `FileNotFoundError` for a missing source file.
