# Errors

> Every error code the API answers with, and what to do about it.

An error is a problem document (RFC 9457), sent as `application/problem+json`:

```json
{
  "type": "https://developers.aigently.ai/errors/invalid_variables",
  "title": "The variables do not fit this agent",
  "status": 422,
  "code": "invalid_variables",
  "detail": "1 variable is missing or invalid.",
  "errors": [
    {
      "field": "variables.first_name",
      "code": "required",
      "message": "Required"
    }
  ],
  "request_id": "a3f9c1e07b2d4c4e"
}
```

Program against `code`, which never changes. `detail` is a sentence for a person and may be reworded; `errors` names each field a validation failure found. Quote `request_id` when you ask for help — it is also in every response's `X-Request-ID` header.

| Status | Code | Means |
|---|---|---|
| `400` | [`idempotency_key_required`](/errors/idempotency_key_required) | An Idempotency-Key header is required |
| `400` | [`invalid_request`](/errors/invalid_request) | The request is not valid |
| `401` | [`authentication_failed`](/errors/authentication_failed) | The API key was not accepted |
| `402` | [`insufficient_credit`](/errors/insufficient_credit) | There is not enough credit |
| `403` | [`address_not_allowed`](/errors/address_not_allowed) | The key does not work from this address |
| `403` | [`live_key_in_browser`](/errors/live_key_in_browser) | A live key was sent from a browser |
| `403` | [`live_key_required`](/errors/live_key_required) | Only a live key does this |
| `403` | [`organization_frozen`](/errors/organization_frozen) | The organization is frozen |
| `403` | [`permission_denied`](/errors/permission_denied) | This key does not have that permission |
| `403` | [`test_key_required`](/errors/test_key_required) | Only a test key does this |
| `404` | [`not_found`](/errors/not_found) | Not found |
| `405` | [`method_not_allowed`](/errors/method_not_allowed) | That method is not allowed here |
| `409` | [`agent_name_taken`](/errors/agent_name_taken) | The project already has an agent with that name |
| `409` | [`agent_not_inbound`](/errors/agent_not_inbound) | The agent does not answer calls |
| `409` | [`agent_not_outbound`](/errors/agent_not_outbound) | The agent does not place calls |
| `409` | [`agent_not_publishable`](/errors/agent_not_publishable) | The agent is not ready to publish |
| `409` | [`agent_not_published`](/errors/agent_not_published) | The agent is not published |
| `409` | [`browser_voice_off`](/errors/browser_voice_off) | The agent does not take browser calls |
| `409` | [`campaign_empty`](/errors/campaign_empty) | The campaign has nobody to call |
| `409` | [`campaign_finished`](/errors/campaign_finished) | The campaign has finished |
| `409` | [`campaign_status_conflict`](/errors/campaign_status_conflict) | The campaign is not in a state this applies to |
| `409` | [`contact_exists`](/errors/contact_exists) | The number is already in the phonebook |
| `409` | [`contacts_missing_values`](/errors/contacts_missing_values) | Contacts lack a value the agent says out loud |
| `409` | [`conversation_busy`](/errors/conversation_busy) | The agent is still answering the last message |
| `409` | [`conversation_ended`](/errors/conversation_ended) | The conversation has ended |
| `409` | [`conversation_in_progress`](/errors/conversation_in_progress) | The conversation is still in progress |
| `409` | [`conversation_limit_reached`](/errors/conversation_limit_reached) | The conversation has reached its length |
| `409` | [`conversation_not_answered`](/errors/conversation_not_answered) | The call has not been answered yet |
| `409` | [`crawl_running`](/errors/crawl_running) | The website is being read |
| `409` | [`credential_revoked`](/errors/credential_revoked) | The credential is revoked |
| `409` | [`do_not_call`](/errors/do_not_call) | The number is on the do-not-call list |
| `409` | [`duplicate_source`](/errors/duplicate_source) | The file is already in the knowledge base |
| `409` | [`evaluation_limit_reached`](/errors/evaluation_limit_reached) | The agent has as many evaluations as it can keep |
| `409` | [`evaluation_run_in_progress`](/errors/evaluation_run_in_progress) | An evaluation run is already going |
| `409` | [`name_taken`](/errors/name_taken) | That name is taken |
| `409` | [`not_a_file`](/errors/not_a_file) | The source is not a file |
| `409` | [`number_agent_mismatch`](/errors/number_agent_mismatch) | The number and the agent do not fit |
| `409` | [`outside_call_window`](/errors/outside_call_window) | The call's window is closed |
| `409` | [`project_frozen`](/errors/project_frozen) | The project is frozen |
| `409` | [`scheduled_call_finished`](/errors/scheduled_call_finished) | The scheduled call has already happened |
| `409` | [`scheduled_call_placing`](/errors/scheduled_call_placing) | The scheduled call is being placed |
| `409` | [`source_indexing`](/errors/source_indexing) | The source is being indexed |
| `409` | [`transfer_already_requested`](/errors/transfer_already_requested) | The call is already being transferred |
| `409` | [`unsupported_channel`](/errors/unsupported_channel) | Not possible on this channel |
| `409` | [`whatsapp_not_ready`](/errors/whatsapp_not_ready) | The WhatsApp connection cannot send templates yet |
| `413` | [`file_too_large`](/errors/file_too_large) | The file is too large |
| `413` | [`request_too_large`](/errors/request_too_large) | The request is too large |
| `415` | [`unsupported_file_type`](/errors/unsupported_file_type) | Not a file the knowledge base reads |
| `422` | [`caller_id_unavailable`](/errors/caller_id_unavailable) | There is no number to call from |
| `422` | [`conversation_too_short`](/errors/conversation_too_short) | The conversation is too short to analyse |
| `422` | [`destination_not_allowed`](/errors/destination_not_allowed) | That number cannot be called |
| `422` | [`idempotency_key_reused`](/errors/idempotency_key_reused) | The Idempotency-Key was used for a different request |
| `422` | [`invalid_variables`](/errors/invalid_variables) | The variables do not fit this agent |
| `422` | [`model_misconfigured`](/errors/model_misconfigured) | The agent's model is set up wrongly |
| `422` | [`source_limit_reached`](/errors/source_limit_reached) | The knowledge base is full |
| `422` | [`test_number_required`](/errors/test_number_required) | Test keys can only call test numbers |
| `422` | [`unknown_agent_version`](/errors/unknown_agent_version) | The agent has no such version |
| `422` | [`unknown_field`](/errors/unknown_field) | The request has a field this endpoint does not take |
| `422` | [`validation_failed`](/errors/validation_failed) | The request did not pass validation |
| `424` | [`provider_key_missing`](/errors/provider_key_missing) | A provider credential is missing |
| `429` | [`concurrency_limit_reached`](/errors/concurrency_limit_reached) | Too many calls at once |
| `429` | [`daily_limit_reached`](/errors/daily_limit_reached) | The daily call limit is reached |
| `429` | [`limits_unavailable`](/errors/limits_unavailable) | Limits cannot be checked just now |
| `429` | [`rate_limited`](/errors/rate_limited) | Too many requests |
| `500` | [`internal_error`](/errors/internal_error) | Something went wrong on our side |
| `501` | [`feature_disabled`](/errors/feature_disabled) | Not available on this deployment |
| `502` | [`upstream_unavailable`](/errors/upstream_unavailable) | A service the platform depends on is not answering |
