Skip to content

Error on first-time dev server /run with default sandbox-sdk template #201

@jldec

Description

@jldec

I can no longer reproduce this (I think it's timing related), but maybe the trace is helpful. Feel free to close.

Running the minimal example template locally with pnpm dev errored when I opened http://localhost:8787/run in the browser for the first time.

The browser showed the error as well, but unfortunately I did not screenshot it. Below is the log from the console. I had to start Docker Desktop because it was not running initially. The error happened on the 2nd pnpm dev. I'm on a M1 mac so maybe the initial image emulation was a bit slow.

~/cloudflare$ pnpm create cloudflare@latest c3-sandbox-nov-10 --template=cloudflare/sandbox-sdk/examples/minimal
.../19a6e0c4426-db98                     |   +1 +
.../19a6e0c4426-db98                     | Progress: resolved 1, reused 0, downloaded 1, added 1, done

────────────────────────────────────────────────────────────
👋 Welcome to create-cloudflare v2.54.3!
🧡 Let's get started.
────────────────────────────────────────────────────────────

╭ Create an application with Cloudflare Step 1 of 3

├ In which directory do you want to create your application?
│ dir ./c3-sandbox-nov-10

├ What would you like to start with?
│ category Template from a GitHub repo

├ What's the url of git repo containing the template you'd like to use?
│ repository cloudflare/sandbox-sdk/examples/minimal

├ Cloning template from: cloudflare/sandbox-sdk/examples/minimal

├ template cloned and validated

├ Copying template files
│ files copied to project directory

├ Installing dependencies
│ installed via `pnpm install`

╰ Application created

╭ Configuring your application for Cloudflare Step 2 of 3

├ Installing wrangler A command line tool for building Cloudflare Workers
│ installed via `pnpm install wrangler --save-dev`

├ Generating types for your application
│ generated to `./worker-configuration.d.ts` via `pnpm run cf-typegen`

├ Installing @types/node
│ installed via pnpm

├ Do you want to use git for version control?
│ yes git

├ Initializing git repo
│ initialized git

├ Committing new files
│ git commit

╰ Application configured

╭ Deploy with Cloudflare Step 3 of 3

├ Do you want to deploy your application?
│ no deploy via `pnpm run deploy`

╰ Done

────────────────────────────────────────────────────────────
🎉  SUCCESS  Application created successfully!

💻 Continue Developing
Change directories: cd c3-sandbox-nov-10
Start dev server: pnpm run start
Deploy: pnpm run deploy

📖 Explore Documentation
https://developers.cloudflare.com/workers

🐛 Report an Issue
https://github.com/cloudflare/workers-sdk/issues/new/choose

💬 Join our Community
https://discord.cloudflare.com
────────────────────────────────────────────────────────────


~/cloudflare$ cd1
[email protected] main ~/cloudflare/c3-sandbox-nov-10$ pnpm dev

> @cloudflare/[email protected] dev /Users/jldec/cloudflare/c3-sandbox-nov-10
> wrangler dev


 ⛅️ wrangler 4.46.0
───────────────────
Your Worker has access to the following bindings:
Binding                    Resource            Mode
env.Sandbox (Sandbox)      Durable Object      local

╭───────────────────────────────────────────────────────────────────────────────────────────────╮
│  [b] open a browser [d] open devtools [r] rebuild container(s) [c] clear console [x] to exit  │
╰───────────────────────────────────────────────────────────────────────────────────────────────╯
⎔ Preparing container image(s)...

✘ [ERROR] The Docker CLI could not be launched. Please ensure that the Docker CLI is installed and the daemon is running.

  Other container tooling that is compatible with the Docker CLI and engine may work, but is not yet
  guaranteed to do so. You can specify an executable with the environment variable
  WRANGLER_DOCKER_BIN and a socket with DOCKER_HOST.
  To suppress this error if you do not intend on triggering any container instances, set
  dev.enable_containers to false in your Wrangler config or passing in --enable-containers=false.


Cannot connect to the Docker daemon at unix:///Users/jldec/.docker/run/docker.sock. Is the docker daemon running?
🪵  Logs were written to "/Users/jldec/Library/Preferences/.wrangler/logs/wrangler-2025-11-10_13-55-16_472.log"
 ELIFECYCLE  Command failed with exit code 1.

[email protected] main ~/cloudflare/c3-sandbox-nov-10$ pnpm dev

> @cloudflare/[email protected] dev /Users/jldec/cloudflare/c3-sandbox-nov-10
> wrangler dev


 ⛅️ wrangler 4.46.0
───────────────────
Your Worker has access to the following bindings:
Binding                    Resource            Mode
env.Sandbox (Sandbox)      Durable Object      local

╭───────────────────────────────────────────────────────────────────────────────────────────────╮
│  [b] open a browser [d] open devtools [r] rebuild container(s) [c] clear console [x] to exit  │
╰───────────────────────────────────────────────────────────────────────────────────────────────╯
⎔ Preparing container image(s)...
[+] Building 16.3s (6/6) FINISHED                                                                                                                docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                             0.0s
 => => transferring dockerfile: 291B                                                                                                                             0.0s
 => [internal] load metadata for docker.io/cloudflare/sandbox:0.4.17                                                                                             2.4s
 => [auth] cloudflare/sandbox:pull token for registry-1.docker.io                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                0.0s
 => => transferring context: 2B                                                                                                                                  0.0s
 => [1/1] FROM docker.io/cloudflare/sandbox:0.4.17@sha256:2cb082a5319d5864a247e2307535d63300fa66d9526ef3e2f0382e72180ce49c                                      13.8s
 => => resolve docker.io/cloudflare/sandbox:0.4.17@sha256:2cb082a5319d5864a247e2307535d63300fa66d9526ef3e2f0382e72180ce49c                                       0.0s
 => => sha256:af6eca94c8104c8e90d3f9efe59c2b3a02b20aad3d985e31c7cd009ea104c447 29.54MB / 29.54MB                                                                 1.8s
 => => sha256:9b83c0f6a9afeb1cfc2a70bfaae55f7022a1acabbc6c0c2e38cb15f381110a23 99B / 99B                                                                         1.0s
 => => sha256:eb96092021509e0af9c7b08e5b47e99e87ca9720c4030ac79fd2c90bf7d93bf7 2.78MB / 2.78MB                                                                   1.6s
 => => sha256:640da97d2e6d63d4e7e4a4288141e76bfd7113f0598ab78afbaf2e0326db92b3 207B / 207B                                                                       1.1s
 => => sha256:775e69226362b7db5c16afd79867fe31f242b05c54891a74cd9e113b0f0b9f06 46.58MB / 46.58MB                                                                 9.1s
 => => sha256:f9759eb37605dc346e61df11569ec212ef45d03402583ddbcd54d5a7842484f9 47.93MB / 47.93MB                                                                 8.2s
 => => sha256:a5dda11b1bc9c1a184fadfcefc22ce0bf4d3033a35d1575a644dec8c8036ee48 4.24kB / 4.24kB                                                                   0.6s
 => => sha256:8a22a7a78beaff18a4b8843054520b1954c832ba40405b813023cd3c949d4024 910B / 910B                                                                       0.6s
 => => sha256:c46a90003922e5177c15a2fb2514e8d9f54362738f11d482980459824c5ceb88 85.38MB / 85.38MB                                                                11.1s
 => => sha256:001baebfb7595d786e83214bc6e5098862eefc25470d211fedf6bd2dd727e53f 36.57MB / 36.57MB                                                                 4.7s
 => => sha256:6e44026691ebd48292c70067d5d10614947076cc89e8ac6c18dbeb823d4b3d34 481B / 481B                                                                       0.6s
 => => sha256:db7b3da6b3b04069185ddf05cbea8efe89cf15eceab6071268fb05e6b511afd2 451B / 451B                                                                       0.6s
 => => sha256:c223d102416138579d792560764f1408d8fa1ee3ccc63068acb80daf25880a8a 40.75MB / 40.75MB                                                                 5.5s
 => => sha256:9780cde61a59a8ab19e2ceb16be1810a10773f3dfa6a37871a7c336f626344ca 106B / 106B                                                                       0.7s
 => => sha256:6a960f117706a6815c4343a6e4ad529ca0dfca8382e5fffa879c61bcd18d6b23 107.06kB / 107.06kB                                                               0.7s
 => => sha256:325e527e122b27d4ca0df2fde032bea11ea0881a5f83f154443ac2f1c62cd6fb 5.34MB / 5.34MB                                                                   1.5s
 => => sha256:0c720f5bd7dfb40943d7db938da638ff23ab4a04ce4c6e5a26e5ef67aaf69ae2 2.97kB / 2.97kB                                                                   0.6s
 => => sha256:a6b3160dd1d30530dbe1d6ead090547b941b8180f3c87038ed89fc2e41c946ac 23.65kB / 23.65kB                                                                 0.6s
 => => sha256:333b8ba99dfb373fc9a8650946d0598e1042390fd496e1533c7e16b0f36f71f8 180B / 180B                                                                       0.6s
 => => sha256:93032f0474f3d6f14e6dd000deb1ea07ec46431541f80b1f04a77e4532043e1f 185B / 185B                                                                       0.6s
 => exporting to image                                                                                                                                          13.7s
 => => exporting layers                                                                                                                                          0.0s
 => => exporting manifest sha256:fcdbc8e9ae6735beea27bcf974fb8fc5e15b7bb2fa70a2257019bfdbe009dd82                                                                0.0s
 => => exporting config sha256:ca8b7178f30fe0b4b36324593b1cae6694b13fa9ee75868ba06d26e61baed273                                                                  0.0s
 => => naming to docker.io/cloudflare-dev/sandbox:cd638d9d                                                                                                       0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/1ybfk50ufk2h02il96bi4xnok

What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview
⎔ Container image(s) ready
⎔ Starting local server...
[wrangler:info] Ready on http://localhost:8787
[wrangler:info] GET / 200 OK (8ms)
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
✘ [ERROR] {"level":"error","msg":"Sandbox error","component":"sandbox-do","sandboxId":"ac481a738160eb66d7bbc3bf1bd45c64e6ce2484ad762d9eca5f9ea7840cfad8","traceId":"tr_488bb1a78a104483","timestamp":"2025-11-10T13:56:49.778Z","error":{"message":"Monitor failed to find container","stack":"Error: Monitor failed to find container","name":"Error"}}


✘ [ERROR] {"level":"error","msg":"Unexpected error in createSession","component":"sandbox-do","sandboxId":"ac481a738160eb66d7bbc3bf1bd45c64e6ce2484ad762d9eca5f9ea7840cfad8","traceId":"tr_488bb1a78a104483","httpStatus":500,"timestamp":"2025-11-10T13:56:49.782Z","error":{"message":"HTTP error! status: 500","stack":"SandboxError: HTTP error! status: 500\n    at createErrorFromResponse (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/.wrangler/tmp/dev-woJec4/index.js:2936:14)\n    at UtilityClient.handleErrorResponse (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/.wrangler/tmp/dev-woJec4/index.js:3045:20)\n    at async UtilityClient.handleResponse (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/.wrangler/tmp/dev-woJec4/index.js:3015:23)\n    at async UtilityClient.createSession (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/.wrangler/tmp/dev-woJec4/index.js:3777:24)\n    at async Sandbox.ensureDefaultSession (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/.wrangler/tmp/dev-woJec4/index.js:4218:9)\n    at async Sandbox.exec (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/.wrangler/tmp/dev-woJec4/index.js:4237:21)","name":"SandboxError"}}


[wrangler:error] Error: SandboxError: HTTP error! status: 500
    at async Object.fetch (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/src/index.ts:14:22)
    at async jsonError (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/node_modules/.pnpm/[email protected]/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:10)
    at async drainBody (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/node_modules/.pnpm/[email protected]/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts:5:10)
✘ [ERROR] Uncaught SandboxError: HTTP error! status: 500 Error

      at createErrorFromResponse
  (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/node_modules/.pnpm/@[email protected]/node_modules/@cloudflare/sandbox/src/errors/adapter.ts:230:14)
      at handleErrorResponse
  (file:///Users/jldec/cloudflare/c3-sandbox-nov-10/node_modules/.pnpm/@[email protected]/node_modules/@cloudflare/sandbox/src/clients/base-client.ts:179:19)


[wrangler:info] GET /run 500 Internal Server Error (3167ms)
Error checking if container is ready: connect(): Connection refused: container port not found. Make sure you exposed the port in your container definition.
Error checking if container is ready: The operation was aborted
Port 3000 is ready
{"level":"info","msg":"Version retrieved completed successfully","component":"sandbox-do","sandboxId":"ac481a738160eb66d7bbc3bf1bd45c64e6ce2484ad762d9eca5f9ea7840cfad8","traceId":"tr_c2e2fa6b80ba44ba","details":"0.4.17","timestamp":"2025-11-10T13:58:38.913Z"}
{"level":"info","msg":"Session created completed successfully","component":"sandbox-do","sandboxId":"ac481a738160eb66d7bbc3bf1bd45c64e6ce2484ad762d9eca5f9ea7840cfad8","traceId":"tr_c2e2fa6b80ba44ba","details":"ID: sandbox-my-sandbox","timestamp":"2025-11-10T13:58:38.931Z"}
{"level":"info","msg":"Command executed completed successfully","component":"sandbox-do","sandboxId":"ac481a738160eb66d7bbc3bf1bd45c64e6ce2484ad762d9eca5f9ea7840cfad8","traceId":"tr_c2e2fa6b80ba44ba","details":"python3 -c \"print(2 + 2)\", Success: true","timestamp":"2025-11-10T13:58:39.116Z"}
[wrangler:info] GET /run 200 OK (5891ms)
{"level":"info","msg":"Command executed completed successfully","component":"sandbox-do","sandboxId":"ac481a738160eb66d7bbc3bf1bd45c64e6ce2484ad762d9eca5f9ea7840cfad8","traceId":"tr_c2e2fa6b80ba44ba","details":"python3 -c \"print(2 + 2)\", Success: true","timestamp":"2025-11-10T13:59:29.580Z"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions