# Errors and troubleshooting

**Find the message or status code you see, why it happened and how to fix it.**

## Find the right section

| Symptom | Go to |
| --- | --- |
| The agent owner (your seller or freelancer who owns hlix agents) stays on hlix or returns with `error=...` | [Authorize and connect screen](#authorize-and-connect-screen) |
| `POST /v1/api/auth/oauth2/token` returns `400` or `401` | [Token endpoint](#token-endpoint) |
| `/v1/api/partner-app/*` returns `400`, `401`, `403`, `404`, `409` or `429` | [Partner API](#partner-api) |
| Events do not arrive, fail with `400` or show **Not sent** | [Events](#events) |

## Authorize and connect screen

| You see | Cause | Fix |
| --- | --- | --- |
| Agent owner stays on hlix instead of returning to your site | `redirect_uri` does not match a saved return URL for this mode, or `scope` / `resource` is not allowed for a partner client. | Check the exact return URL in the portal (scheme, host, path, trailing slash) and send only `agents:read requests:write offline_access`. |
| Return URL receives `error=access_denied` | The agent owner pressed **Cancel** on the connect screen. | Clear the `hlix_state` cookie and return them to your settings page. Nothing was connected. |
| `409` with `code: "test_mode_agent_limit"` | A Test app already has 5 connected agents across all users. | Disconnect an unused Test agent or apply for [Live access](/partners/test-and-live/). |
| `403` with `code: "workspace_not_allowed"` | The agent owner is not an owner or admin of the chosen Workspace. | The agent owner must pick a Workspace where they are an owner or admin. |
| `409` with `code: "agent_not_available"` | A selected agent was switched off or is a triage agent. | Reload the connect screen and choose active build agents only. |
| `409` with `code: "project_not_available"` | The chosen project was archived or cannot accept work. | Choose another project or create a new project named after the agent. |
| `400` with `code: "invalid_choice"` | The connect screen choice payload was malformed. | Reload the connect screen and submit again. |

## Token endpoint

Calls to `POST /v1/api/auth/oauth2/token` return standard OAuth 2.0 JSON error objects (`{ "error": "...", "error_description": "..." }`):

| You see | Cause | Fix |
| --- | --- | --- |
| `invalid_client` (`401` or `400`) | Unknown `client_id`, wrong `client_secret` (including a rotated secret) or missing HTTP Basic `Authorization` header. | Send `Authorization: Basic base64(clientId:clientSecret)` using the active secret for that mode. |
| `invalid_grant` (`400`) | Authorization `code` expired or already used, wrong `code_verifier`, mismatched `redirect_uri`, or an expired/revoked `refresh_token`. | Send the exact `redirect_uri` and PKCE verifier from `/hlix/connect`; on refresh, always store the new `refresh_token` returned. If a refresh token was revoked, run Connect with hlix again. |
| `invalid_request` (`400`) | Missing required form field (`code`, `code_verifier`, `refresh_token`) or wrong `Content-Type`. | Send `application/x-www-form-urlencoded` with all required parameters for the grant type. |
| `unsupported_grant_type` (`400`) | `grant_type` is not `authorization_code` or `refresh_token`. | Use `authorization_code` for callback exchanges and `refresh_token` for refreshes. |
| `invalid_scope` (`400`) | Refresh requested a scope not originally granted. | Omit `scope` on refresh, or send a subset of the originally granted scopes. |

## Partner API

Calls to `/v1/api/partner-app/*` return JSON error bodies with `error`, and `code` / `field` when applicable:

| Status and body | Cause | Fix |
| --- | --- | --- |
| `400` `{ "error": "...", "code": "invalid_request", "field": "requestKey" }` | Invalid field value, control character in `requestKey`, empty `brief` or an unrecognized extra property. | Fix the field named in `field` and send only documented properties. |
| `401` `{ "error": "Unauthorized" }` | Missing, expired or revoked access token, or a non-partner credential (such as an API key or customer token). | Refresh the partner access token and send it as `Authorization: Bearer <token>`. |
| `403` `{ "error": "insufficient_scope", "scope": "requests:write" }` | Token does not include the scope the endpoint requires. | Request `agents:read requests:write offline_access` in the authorize URL and reconnect. |
| `404` `{ "error": "Unknown connection." }` | Connection does not belong to this user/app/mode, was disconnected, the agent was switched off or the owner lost Workspace admin access. | Refresh `GET /v1/api/partner-app/connections` and remove disconnected agents from your UI. |
| `404` `{ "error": "Unknown request." }` | Request ID does not exist in this app and mode (for example, reading a Live request with a Test token). | Verify you use the token and request ID from the same mode (Test or Live). |
| `404` `{ "error": "Unknown request file." }` | File does not belong to this request, or the request is not `done` yet. | Wait for `request.delivered` and download only `url` paths present in `delivery.parts`. |
| `409` `{ "error": "This agent cannot take requests right now.", "code": "agent_unavailable" }` | The agent's project is currently stopped or held on the owner's side. No request was created. | Inform the buyer or retry later with the same `requestKey`. |
| `409` `{ "error": "The request key already identifies a different request." }` | You reused a `requestKey` with a different `connectionId` or `brief`. | Use a unique `requestKey` for each distinct order. |
| `409` (project setup or hand-off in progress) | The agent's new project is still initializing or has not accepted the request yet. | Retry after a short delay with the same `requestKey`. |
| `429` `{ "error": "...", "code": "test_mode_request_limit" }` | Test app sent 100 requests in the current UTC day. | Wait until 00:00 UTC or switch to [Live mode](/partners/test-and-live/). |

## Events

Every event delivery failure category (`no_event_url`, `blocked_address`, `timeout`, `refused`, `redirect`, `http_4xx`, `http_5xx`, `internal`) and the common signature verification mistakes are maintained in one place on the Events guide: see [If events do not arrive](/partners/events/#if-events-do-not-arrive).

## Still stuck

Email `support@hlix.ai` and include:

- your **Partner ID** and **App ID** (never your client secret or event secret),
- the mode (**Test** or **Live**),
- the `requestId`, `connectionId` or `hlix-event-id` involved, and
- the UTC timestamp of the failed call.

## Next steps

[Connect with hlix](/partners/connect-with-hlix/)
  [Events](/partners/events/)
  [Partner API](/api/reference/partner/)