> ## Documentation Index
> Fetch the complete documentation index at: https://e2b-automation-sdk-reference-sync.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

### AuthenticationError

Thrown when authentication fails.

#### Extended by

* `GitAuthError`

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new AuthenticationError(message: string): AuthenticationError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`AuthenticationError`

***

### BuildError

Thrown when the build fails.

#### Extended by

* `FileUploadError`

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new BuildError(message: string, stackTrace?: string): BuildError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |
| `stackTrace`? | `string` |

###### Returns

`BuildError`

***

### FileNotFoundError

Thrown when a file or directory is not found inside a sandbox.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new FileNotFoundError(message: string): FileNotFoundError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`FileNotFoundError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode" /> `statusCode?` | `number` | HTTP status of the API response that produced this error, when there was one. | `NotFoundError`.`statusCode` |

***

### FileUploadError

Thrown when the file upload fails.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new FileUploadError(message: string, stackTrace?: string): FileUploadError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |
| `stackTrace`? | `string` |

###### Returns

`FileUploadError`

***

### ~~GitAuthError~~

Thrown when git authentication fails.

#### Deprecated

Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new GitAuthError(message: string): GitAuthError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`GitAuthError`

***

### ~~GitUpstreamError~~

Thrown when git upstream tracking is missing.

#### Deprecated

Run git with `sandbox.commands.run()` instead. The git module will be removed in the next major version.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new GitUpstreamError(message: string): GitUpstreamError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`GitUpstreamError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode-1" /> ~~`statusCode?`~~ | `number` | HTTP status of the API response that produced this error, when there was one. | `SandboxError`.`statusCode` |

***

### InvalidArgumentError

Thrown when an invalid argument is provided.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new InvalidArgumentError(message: string, stackTrace?: string): InvalidArgumentError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |
| `stackTrace`? | `string` |

###### Returns

`InvalidArgumentError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode-2" /> `statusCode?` | `number` | HTTP status of the API response that produced this error, when there was one. | `SandboxError`.`statusCode` |

***

### NotEnoughSpaceError

Thrown when there is not enough disk space.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new NotEnoughSpaceError(message: string): NotEnoughSpaceError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`NotEnoughSpaceError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode-3" /> `statusCode?` | `number` | HTTP status of the API response that produced this error, when there was one. | `SandboxError`.`statusCode` |

***

### ~~NotFoundError~~

Thrown when a resource is not found.

#### Deprecated

Use FileNotFoundError or SandboxNotFoundError instead. This class will be removed in the next major version.

#### Extended by

* `FileNotFoundError`
* `SandboxNotFoundError`

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new NotFoundError(message: string): NotFoundError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`NotFoundError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode-4" /> ~~`statusCode?`~~ | `number` | HTTP status of the API response that produced this error, when there was one. | `SandboxError`.`statusCode` |

***

### RateLimitError

Thrown when the API rate limit is exceeded.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new RateLimitError(message: string): RateLimitError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`RateLimitError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode-5" /> `statusCode?` | `number` | HTTP status of the API response that produced this error, when there was one. | `SandboxError`.`statusCode` |

***

### SandboxError

Base class for all sandbox errors.

Thrown when general sandbox errors occur.

#### Extended by

* `TimeoutError`
* `InvalidArgumentError`
* `NotEnoughSpaceError`
* `NotFoundError`
* `GitUpstreamError`
* `TemplateError`
* `RateLimitError`

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new SandboxError(message?: string): SandboxError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message`? | `string` |

###### Returns

`SandboxError`

#### Properties

| Property | Type | Description |
| - | - | - |
| <a id="statuscode-6" /> `statusCode?` | `number` | HTTP status of the API response that produced this error, when there was one. |

***

### SandboxNotFoundError

Thrown when a sandbox is not found (e.g. it doesn't exist or is no longer running).

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new SandboxNotFoundError(message: string): SandboxNotFoundError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`SandboxNotFoundError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode-7" /> `statusCode?` | `number` | HTTP status of the API response that produced this error, when there was one. | `NotFoundError`.`statusCode` |

***

### SandboxNotRunningError

Thrown when the sandbox is not running anymore: the proxy in front of it
answered a request (or the health probe run after a request failed at the
connection level) with the sandbox not found — it was killed, paused or
reached its timeout. Retrying the request will not help; create or resume a
sandbox.

The split from `SandboxUnreachableError` is only as good as the proxy's answer
and the health probe: a sandbox that is gone but could not be asked about is a
`SandboxUnreachableError`. `SandboxNotFoundError` is only raised by the control
plane API (e.g. `Sandbox.connect()` to a sandbox that does not exist).

Subclass of `TimeoutError`, which this case surfaced as before.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new SandboxNotRunningError(message: string, options?: ErrorOptions): SandboxNotRunningError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |
| `options`? | `ErrorOptions` |

###### Returns

`SandboxNotRunningError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode-8" /> `statusCode?` | `number` | HTTP status of the API response that produced this error, when there was one. | `TimeoutError`.`statusCode` |

***

### SandboxUnreachableError

Thrown when the sandbox could not be reached while it is not confirmed to be
stopped: the proxy in front of the sandbox reports it running but envd's port
not open (e.g. the sandbox's network is down), the proxy or envd answered
with an unavailability the health probe could not resolve (e.g. the connection
to the sandbox was lost mid-stream while the probe found it running), or a
request failed at the connection level (the connection could not be
established or was dropped mid-request) and the follow-up health probe got
no answer from the sandbox either. A sandbox confirmed stopped (or paused) is
a `SandboxNotRunningError` — but only as far as the probe can tell: a sandbox
that is gone and could not be asked about surfaces here.

This usually means the sandbox's network is down, envd inside it is not up
(yet), or a network issue between the client and the sandbox. Check the
sandbox state with `Sandbox.getInfo()`.

Subclass of `TimeoutError`, which these cases surfaced as before.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new SandboxUnreachableError(message: string, options?: ErrorOptions): SandboxUnreachableError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |
| `options`? | `ErrorOptions` |

###### Returns

`SandboxUnreachableError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode-9" /> `statusCode?` | `number` | HTTP status of the API response that produced this error, when there was one. | `TimeoutError`.`statusCode` |

***

### SecretError

Base class for all secret errors.

Thrown when general secret errors occur.

#### Extended by

* `SecretNotFoundError`

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new SecretError(message: string): SecretError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`SecretError`

***

### SecretNotFoundError

Thrown when a secret is not found.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new SecretNotFoundError(message: string): SecretNotFoundError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`SecretNotFoundError`

***

### ServiceBusyError

Thrown when the API refused the operation because the service is
temporarily busy (HTTP 503): no capacity to place a sandbox right now, or
the node running the sandbox declined a request it cannot serve yet.

Nothing was changed by the refused call: for example a refused pause
leaves the sandbox running with its state intact, so the same call can be
retried after a short wait.

Like AuthenticationError and unlike the other API errors, this is
not a SandboxError: it is raised for every 503 whatever the
operation, so catch it explicitly.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new ServiceBusyError(message: string): ServiceBusyError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`ServiceBusyError`

#### Properties

| Property | Modifier | Type | Default value | Description |
| - | - | - | - | - |
| <a id="statuscode-10" /> `statusCode` | `readonly` | `503` | `503` | HTTP status of the API response: always 503. |

***

### TemplateError

Thrown when the template uses old envd version. It isn't compatible with the new SDK.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new TemplateError(message: string, stackTrace?: string): TemplateError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |
| `stackTrace`? | `string` |

###### Returns

`TemplateError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode-11" /> `statusCode?` | `number` | HTTP status of the API response that produced this error, when there was one. | `SandboxError`.`statusCode` |

***

### TimeoutError

Thrown when a timeout error occurs.

The \[unavailable] error type is caused by sandbox timeout.

The \[canceled] error type is caused by exceeding request timeout.

The \[deadline\_exceeded] error type is caused by exceeding the timeout for command execution, watch, etc.

The \[unknown] error type is sometimes caused by the sandbox timeout when the request is not processed correctly.

#### Extended by

* `SandboxNotRunningError`
* `SandboxUnreachableError`

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new TimeoutError(message: string): TimeoutError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`TimeoutError`

#### Properties

| Property | Type | Description | Inherited from |
| - | - | - | - |
| <a id="statuscode-12" /> `statusCode?` | `number` | HTTP status of the API response that produced this error, when there was one. | `SandboxError`.`statusCode` |

***

### VolumeError

Base class for all volume errors.

Thrown when general volume errors occur.

#### Extended by

* `VolumeNotFoundError`
* `VolumePathNotFoundError`

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new VolumeError(message: string): VolumeError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`VolumeError`

***

### VolumeNotFoundError

Thrown when a volume is not found.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new VolumeNotFoundError(message: string): VolumeNotFoundError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`VolumeNotFoundError`

***

### VolumePathNotFoundError

Thrown when a file or directory is not found inside a volume.

#### Constructors

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
new VolumePathNotFoundError(message: string): VolumePathNotFoundError
```

###### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

###### Returns

`VolumePathNotFoundError`

## Functions

### formatSandboxUnavailableError()

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
function formatSandboxUnavailableError(message: string): Error
```

Maps a 502/Unavailable answered by the proxy in front of envd: the sandbox was not
found (killed or reached its timeout) is a `SandboxNotRunningError`; the sandbox
running but envd's port not open (e.g. its network is down) a
`SandboxUnreachableError`; any other message (e.g. envd ending a stream because
the connection to the sandbox was lost) a `SandboxUnreachableError` too, with the
sandbox state reported as unknown.

#### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

#### Returns

`Error`

***

### isSandboxNotFoundMessage()

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
function isSandboxNotFoundMessage(message: string): boolean
```

#### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

#### Returns

`boolean`

***

### isSandboxPortNotOpenMessage()

```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
function isSandboxPortNotOpenMessage(message: string): boolean
```

#### Parameters

| Parameter | Type |
| - | - |
| `message` | `string` |

#### Returns

`boolean`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.