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

# SDK Errors

> How to handle errors from the Anti AI SDK.

## Python

```python theme={null}
from oculus_sdk.exceptions import OculusAPIError, OculusAuthError, TokenRevokedException

try:
    token = client.get_token(scope="db:read")
except OculusAuthError as e:
    print(f"Auth error ({e.status_code}): {e}")
    print(f"Details: {e.details}")
except TokenRevokedException as e:
    print(f"Token revoked: {e}")
    send_alert("Agent token was revoked — check Anti AI dashboard")
    raise
except OculusAPIError as e:
    print(f"API error ({e.status_code}): {e}")
    print(f"Details: {e.details}")
```

## TypeScript

```typescript theme={null}
import { OculusAPIError, OculusAuthError, TokenRevokedException } from '@oculus/sdk';

try {
  const token = await client.getToken('db:read');
} catch (err) {
  if (err instanceof TokenRevokedException) {
    console.error('Token revoked — check Anti AI dashboard');
  } else if (err instanceof OculusAuthError) {
    console.error(`Auth error (${err.statusCode}): ${err.message}`);
  } else if (err instanceof OculusAPIError) {
    console.error(`API error (${err.statusCode}): ${err.message}`);
  } else {
    throw err;
  }
}
```

## `TokenRevokedException` — what it means

This means an operator **intentionally** revoked your agent's access. Do not silently retry.

1. Check the audit log to see who revoked the token and why
2. If revoked by mistake, check the agent's status — if suspended, unsuspend it
3. If permanently revoked, create a new agent

## TRL polling not working

Verify the `base_url` is reachable:

```python theme={null}
import httpx
resp = httpx.get("https://api.antiailabs.com/oauth/revoked-tokens")
print(resp.status_code)  # Should be 200
```
