Skip to main content
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:
{ 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

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.