> ## 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

# Why does my custom template fail with 'port 49999 not open'? (/docs/faq/port-49999-not-open)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 479 · updated: 2026-07-30 -->
Related: [How do I increase my concurrency limit?](/docs/faq/increase-concurrency.md), [Do paused sandboxes count toward the concurrency limit?](/docs/faq/paused-sandboxes-concurrency.md), [Is there a limit on how many templates I can create?](/docs/faq/template-limit.md), [Can I make a template public so other projects can use it?](/docs/faq/public-templates.md), [Can I run sandboxes in the EU?](/docs/faq/eu-region.md), [Why does iptables fail with 'xt_owner module missing' in a sandbox?](/docs/faq/iptables-xt-owner.md)

If you call `.runCode` / `.run_code` from the E2B Code Interpreter SDK against a custom template and see this error, the Code Interpreter service inside the sandbox didn't start. This usually happens because the template was built without the Code Interpreter base image, or because the start command was not set.

**Example error**

```txt
{"sandboxId":"ilmqag7sxz49zjc3gex7x","message":"The sandbox is running but port is not open","port":49999,"code":502}: This error is likely due to sandbox timeout. You can modify the sandbox timeout by passing 'timeout' when starting the sandbox or calling '.set_timeout' on the sandbox with the desired timeout.
```

## Solution

The simplest fix is to base your template on the official `code-interpreter-v1` template, which already includes the start command and the Code Interpreter service.

<CodeGroup>
```js title="JavaScript & TypeScript"
import { Template } from '@e2b/code-interpreter'

const template = Template().fromTemplate("code-interpreter-v1")
```

```python title="Python"
from e2b_code_interpreter import Template

template = Template().from_template("code-interpreter-v1")
```
</CodeGroup>

<Note>We strongly recommend the approach above. If you need to build from the Docker image directly instead, you must also set the start command yourself:</Note>

<CodeGroup>
```ts title="JavaScript & TypeScript"
import { Template, waitForURL } from '@e2b/code-interpreter'

const template = Template()
    .fromImage("e2bdev/code-interpreter:latest")
    .setStartCmd(
        "sudo /root/.jupyter/start-up.sh", waitForURL("http://localhost:49999/health")
    )
```

```python title="Python"
from e2b_code_interpreter import Template, wait_for_url

template = (
    Template()
    .from_image("e2bdev/code-interpreter:latest")
    .set_start_cmd(
        "sudo /root/.jupyter/start-up.sh", wait_for_url("http://localhost:49999/health")
    )
)
```
</CodeGroup>
