> For the complete documentation index, see [llms.txt](https://the-bet-brothers.gitbook.io/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://the-bet-brothers.gitbook.io/doc/addendum/tbb-error-codes.md).

# TBB Error Codes

When an error occurs while processing a request on **The Bet Brothers Platform**, the platform responds with an **HTTP error code** and a detailed **JSON object** that describes the specific error encountered. This error object can have different structures depending on the nature of the error.

### **Example Error Response Structures**

#### 1. **Errors Containing a Field-Specific Message**

In some cases, the `errors` field might contain specific fields (such as `ip_address`), each with its own array of error messages. This structure is used when multiple validation errors need to be reported, particularly for different fields within the request.

```json
{
    "status": "error",
    "errors": {
        "ip_address": [
            "The ip address field is required unless demo is true."
        ]
    }
}

```

* **Explanation**: In this case, the error message is related to the `ip_address` field. The response indicates that the `ip_address` field is missing, which is required unless the `demo` flag is set to `true`. The `errors` object provides a key for the specific field (`ip_address`), and the array under it lists all the error messages related to that field.
* **Usage**: This format is helpful when different fields in the request might have their own validation rules or when there are multiple issues that need to be addressed. Each field that has an issue will have its own entry in the `errors` object with the corresponding error messages.

#### 2. **Errors Containing a General Error Message**

In other cases, the `errors` field might simply contain a list of general error messages without being tied to a specific field in the request. This format is typically used for higher-level errors or issues that don't relate to a particular input field.

```json
{
    "status": "error",
    "errors": [
        "Campaign not found"
    ]
}

```

* **Explanation**: In this example, the error message is not related to a specific field, but rather an overarching issue with the request. The message indicates that a particular **campaign** could not be found. This type of error is more general and does not refer to a specific field, but rather an issue with the request as a whole.
* **Usage**: This format is often used when a resource, such as a campaign, game, or player, cannot be found or does not exist, making it unnecessary to specify which field in the request caused the issue.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://the-bet-brothers.gitbook.io/doc/addendum/tbb-error-codes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
