# Error codes

> What each error forkrail answers with means, and how to fix it. Error responses carry the code in the `x-forkrail-error` header.

- Category: Reference
- URL: https://www.forkrail.com/docs/errors

## Codes

The names match Vercel’s where Vercel has the same error, so existing monitoring keeps working. Each error page also shows the request id, which you can look up with `forkrail logs PROJECT --request ID`.

| Status | Code | What happened, and what to do |
| --- | --- | --- |
| 404 | `DEPLOYMENT_NOT_FOUND` | No deployment answers on this host. Check the domain is added to a project and its DNS points at your install. |
| 404 | `NOT_FOUND` | The deployment has nothing at this path. Add the file or route, or a `404.html`. |
| 401 | `DEPLOYMENT_PROTECTED` | Deployment protection is on and the client has no access. Sign in, or send a [bypass secret](https://www.forkrail.com/docs/deployment-protection#automation). |
| 403 | `FORBIDDEN` | A firewall rule denied the request (`x-forkrail-mitigated: deny`). Check the Firewall page’s Blocked tab. |
| 403 | `CHALLENGE_FAILED` | The firewall’s challenge wasn’t passed. Use a browser, or exempt the client with a bypass rule. |
| 429 | `RATE_LIMITED` | A firewall rate limit was reached. Wait for `retry-after`, or raise the limit. |
| 429 | `TOO_MANY_REQUESTS` | One address sent more than the system mitigations allow. Add a [system bypass](https://www.forkrail.com/docs/firewall#ddos) for trusted traffic. |
| 413 | `FUNCTION_PAYLOAD_TOO_LARGE` | The request body is over 4.5 MB. Upload large files straight to S3 with a signed URL. |
| 494 | `REQUEST_HEADER_TOO_LARGE` | One header field is over 32 KB. Send less in cookies or headers. |
| 431 |  | Over 500 header fields, or about 127.5 KB of headers in all. Send fewer or smaller headers. |
| 500 | `FUNCTION_INVOCATION_FAILED` | Your function threw or crashed. Look at the request’s app output in Logs. |
| 504 | `FUNCTION_INVOCATION_TIMEOUT` | The function ran past its max duration. Raise [max duration](https://www.forkrail.com/docs/functions#max-duration), or move long work to a background job. |
| 500 | `MIDDLEWARE_INVOCATION_FAILED` | Middleware threw. Look at the request’s output in Logs. |
| 504 | `MIDDLEWARE_INVOCATION_TIMEOUT` | Middleware didn’t start answering within its time (25 seconds by default). Do less in middleware, or set its max duration. |
| 508 | `INFINITE_LOOP_DETECTED` | A request called the same project more than 5 levels deep, or over 1,000 times. Check rewrites and fetches that call your own site. |
| 503 | `DEPLOYMENT_PAUSED` | The project reached its [spend limit](https://www.forkrail.com/docs/spend-budgets). Raise the budget, then `forkrail spend resume`. |
| 504 | `ROUTER_EXTERNAL_TARGET_ERROR` | An external rewrite didn’t answer within 120 seconds. Check the other site. |
| 400 | `INVALID_IMAGE_OPTIMIZE_REQUEST` | An image request’s `url`, `w` or `q` isn’t allowed by `images`. Add the width to `sizes`, or the host to `remotePatterns`. |
| 416 | `RANGE_NOT_SATISFIABLE` | A `Range` lies outside the file. Request a range within the file. |
| 421 | `MISDIRECTED_REQUEST` | The request names two different hosts, or a port the router doesn’t answer on. Check the client’s URL and `Host` header. |
| 502 | `ROUTER_STATIC_UNAVAILABLE` | A static file couldn’t be read from S3. Retry; if it persists, check the install’s bucket in AWS. |
