> ## Documentation Index
> Fetch the complete documentation index at: https://docs.illa.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> How SDK methods signal failures and which errors are surfaced

SDK integrations handle errors in two channels:

* Returned API errors (`response.isError === true`)
* Thrown exceptions (configuration/runtime issues)

## Returned API errors

These methods return `SendMessageResult`, where API failures are represented as:

```ts theme={null}
{ response: { isError: true, error: CoreApiChatErrorResponse } }
```

Methods:

* `IllaSDK.sendMessage`
* `IllaSDK.sendToolResult`
* `IllaSDK.sendToolResults`
* `Chat.sendMessage`

## Common thrown errors

* `ChatNotFound`
* `UserContextMissing`
* `TelemetryStreamFailed`
* `SSEParse`
* `StreamingHttpError`
* `StreamingResponseBodyNull`
* `StreamingServerError`

Additional thrown errors to account for in advanced flows:

* `CoreApiAuthenticationMissing` (when constructing `CoreApiProvider` without `x-api-key`)
* `ChatAsyncToolCheckerUnavailable` (calling `Chat.awaitAction` without checker)
* `SdkEmptyToolsResultsError` (calling `sendToolResults` with empty array)

## Practical handling pattern

```ts theme={null}
try {
  const result = await sdk.sendMessage('What can I do?', {
    userContext: { address: '0x1234...' },
  })

  if (result.response.isError) {
    console.error(result.response.error.name, result.response.error.message)
    return
  }

  console.log(result.response.data.text)
} catch (error) {
  console.error('SDK/runtime failure:', error)
}
```

## Streaming handling pattern

For `sendMessageStreaming`, handle failures via `onError` callback and transport exceptions.
