> ## Documentation Index
> Fetch the complete documentation index at: https://e2b.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://e2b.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://e2b.manicule.dev/api/mcp.
> Every agent surface: https://e2b.manicule.dev/.well-known/llms-manifest.json

# Error handling (/docs/template/error-handling)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 234 · updated: 2026-07-30 -->
Related: [Quickstart](/docs/template/quickstart.md), [How it works](/docs/template/how-it-works.md), [User and workdir](/docs/template/user-and-workdir.md), [Caching](/docs/template/caching.md), [Base image](/docs/template/base-image.md), [Private registries](/docs/template/private-registries.md)

> Handle errors in your template

The SDK provides specific error types:

<CodeGroup>
```typescript title="JavaScript & TypeScript"
import { AuthError, BuildError, FileUploadError } from 'e2b';

try {
  await Template.build(template, 'my-template');
} catch (error) {
  if (error instanceof AuthError) {
    console.error("Authentication failed:", error.message);
  } else if (error instanceof FileUploadError) {
    console.error("File upload failed:", error.message);
  } else if (error instanceof BuildError) {
    console.error("Build failed:", error.message);
  }
}
```

```python title="Python"
from e2b import AuthError, BuildError, FileUploadError

try:
    Template.build(template, 'my-template')
except AuthError as error:
    print(f"Authentication failed: {error}")
except FileUploadError as error:
    print(f"File upload failed: {error}")
except BuildError as error:
    print(f"Build failed: {error}")
```
</CodeGroup>
