# Error handling (Tray)

## Overview

When calling operations using the [Call connector endpoint](https://tray.ai/documentation/developer/platform-apis/connectors#endpoint-call-connector) you may experience errors associated with the **input payload** or with the authentication referenced by the `authId`.

If there are **failures of validation**, Tray will return `400`, `403`, `404` etc.

A `200` response means that the input payload and authentication have passed Tray's validation. This is **not a guarantee of success** however, as there **may be an error response from the 3rd party**. Please see our page on [3rd party error handling](https://tray.ai/documentation/developer/getting-started/troubleshooting/error-handling-3rd-party/) for more details.

A request payload for the [Call connector endpoint](https://tray.ai/documentation/developer/platform-apis/connectors#endpoint-call-connector) conforms to the following general structure:

```json
{
  "operation": "operation_name",
  "authId": "af75xxxx-xxxx-xxxx-xxxx-xxxx58c494c5",
  "input": {
    "input_field_1": "",
    "input_field_2": ""
  },
  "returnOutputSchema": false
}
```

> **The required inputs for an operation can be found in the \`inputSchema\` returned by the \`Get Connector Operations\` endpoint.** These input schemas can be very large and complex to navigate. Our [Operations Explorer dev tool](https://tray.ai/documentation/developer/developer-tools/operations-explorer) can help you quickly explore input schema for any connector operations.You can also download our [Form Builder Demo App](https://tray.ai/documentation/developer/developer-tools/connector-tester) to run live tests onOur [Form Builder tutorial](https://tray.ai/documentation/developer/getting-started/tutorials/building-a-ui-form/) offers guidance on using input schema in your applications.

## Input errors

### Missing required inputs

If any required inputs are missing (e.g. `channel` for the Slack `send_messsage` operation) a status of `400 Bad Request` will be returned:

```json query (missing required 'channel' input)
{
  "operation": "send_message",
  "authId": "af75xxxx-xxxx-xxxx-xxxx-xxxx58c494c5",
  "input": {
    "text": "Hello",
    "as_user": true
  },
  "returnOutputSchema": false
}
```

```json 400 Bad Request
{
	"message": "Connector input validation failed. Schema validation errors:
    [ 1 - #: required key [channel] not found ]",
	"code": null
}
```

### Wrong data type

If, for example, you make a call to Google Sheets `get_rows` and pass a string to `number_of_rows` you will receive a `400 Bad Request` and a `Connector input validation failed` message:

```json query
{
  "operation": "get_rows",
  "authId": "925aa19a-xxxx-xxxx-xxxx-966afc72acdc",
  "input": {
    "number_of_rows": "100",
    "spreadsheet_id": "13TF-oSSxxxxxxxxxxxxxxxxbMmgVIhfZ2a40",
    "worksheet_name": "Sheet1"
  },
  "returnOutputSchema": false
}
```

```json 400 Bad Request
{
    "message": "Connector input validation failed. Schema validation errors:
    [ 1 - #/number_of_rows: expected type: Integer, found: String ]",
    "code": null
}
```

> **Even though an input payload may pass all of Tray's validation, there may still be particular requirements or inconsistencies with the 3rd party which will give you errors or unusual responses.**&#x20;

## Auth errors

### Permissions

Suggests authId is found but does not have access to the service being called `403 forbidden`

```json 403 Forbidden
{
  "message": "The request is forbidden",
  "code": null
}
```

### Auth does not exist

No such auth exists:

```json 400 Bad Request
{
  "message": "Invalid value for: body (Couldn't decode a valid UUID at 'authId')",
  "code": null
}
```

### Badly formed authId

```json
{
	"message": "Invalid value for: body (Got value '\"5e7b53b2\"'
    with wrong type, expecting string at 'authId')",
	"code": null
}
```
