From 8a599690d652e48b026a43c909d69ae74ef5a889 Mon Sep 17 00:00:00 2001 From: Amit Maurya Date: Wed, 25 Feb 2026 23:49:44 +0530 Subject: [PATCH] fix: call sandbox.start() before using container Fixes #291 getSandbox() returns a sandbox instance but does not boot the container. Any call to containerFetch() or wsConnect() before start() results in: Error: The container is not running, consider calling start() Adding await sandbox.start() in the sandbox middleware fixes this. start() is idempotent so calling it on every request is safe. --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 3a615dd61..10d39343b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -136,6 +136,7 @@ app.use('*', async (c, next) => { app.use('*', async (c, next) => { const options = buildSandboxOptions(c.env); const sandbox = getSandbox(c.env.Sandbox, 'moltbot', options); + await sandbox.start(); c.set('sandbox', sandbox); await next(); });