Skip to content
This repository was archived by the owner on Jul 7, 2026. It is now read-only.
This repository was archived by the owner on Jul 7, 2026. It is now read-only.

[Bug] Failed to start VM: Sandbox not found #206

Description

@heyalbert

When trying to sign up for my Claude Code Max subscription I receive the following error: Failed to start VM 8lfjd8: Sandbox not found

I am using macOS 26.4.1

Image

Activity

  1. 21st-connector commented on Apr 29, 2026

    @21st-connector
    Contributor

    🤖 Automation triggered: Implement ISSUE

    I'm starting to work on this automatically.


    View live progress

    Powered by 1Code

  2. 21st-connector commented on Apr 29, 2026

    @21st-connector
    Contributor

    🤖 Automation triggered: Analyze Github Issue

    I'm starting to work on this automatically.


    View live progress

    Powered by 1Code

  3. 21st-connector commented on Apr 29, 2026

    @21st-connector
    Contributor

    Issue Triage

    Summary

    This error ("Failed to start VM: Sandbox not found") originates from the server-side E2B sandbox infrastructure, not from the desktop app itself. The desktop app connects to cloud-hosted E2B virtual machines for "sandbox mode" chats, and this error indicates the backend failed to provision or locate a sandbox VM during account setup.

    Codebase Context

    The app has two chat modes (src/renderer/lib/atoms/index.ts:879-887):

    • Local mode — worktree-based chats stored in local SQLite
    • Sandbox mode — cloud-based E2B sandboxes, accessed via URLs like https://3003-{sandboxId}.e2b.app

    Sandbox interactions are handled through backend API endpoints:

    • src/renderer/lib/remote-api.ts — remote chat/sandbox API client (getSandboxDiff, getSandboxFile, export endpoints)
    • src/main/lib/git/sandbox-import.ts — sandbox state import/export logic
    • src/renderer/features/agents/main/active-chat.tsx — sandbox setup status tracking (sandboxSetupStatus, sandboxSetupError)

    The error strings "Failed to start VM" and "Sandbox not found" do not appear anywhere in the desktop app source code, confirming this is a server-side error message being surfaced to the user.

    Subscription & Auth Flow

    The signup flow uses billing methods defined in src/renderer/features/onboarding/billing-method-page.tsx:32-75, with "Claude Pro/Max" (claude-subscription) as the recommended option. User plan data is fetched from the backend via src/main/auth-manager.ts:259-278 (/api/desktop/user/plan).

    Related Issues

    No previous issues match this specific server-side VM provisioning error.

    Likely Cause

    This appears to be a backend/infrastructure issue rather than a desktop app bug. Possible causes:

    1. E2B sandbox provisioning failure — the backend couldn't spin up a VM during account setup
    2. Transient server-side error — the sandbox was created but became unavailable before the client could connect
    3. Account/subscription state mismatch — the signup process may not have fully completed before a sandbox was requested

    Suggested Next Steps

    1. Retry signup — if this was a transient infrastructure issue, retrying may resolve it
    2. Check if the account was created — try signing in again; the subscription may have been activated despite the error
    3. Clear app data and retry — on macOS: rm -rf ~/Library/Application\ Support/Agents\ Dev/ (for dev) or ~/Library/Application\ Support/1Code/ (for production), then relaunch
    4. Server-side investigation needed — the 1Code team should check E2B sandbox provisioning logs for sandbox ID 8lfjd8 to determine why it wasn't found

    This issue likely needs attention from the backend/infrastructure team since the error originates server-side.

  4. 21st-connector commented on Apr 29, 2026

    @21st-connector
    Contributor

    Issue Analysis

    Thanks for reporting this. Here's what I found after reviewing the codebase:

    What's happening

    The "Failed to start VM: Sandbox not found" error originates from the server-side sandbox provisioning, not from the desktop app itself. During the Claude Code Max signup/authentication flow, the app calls the backend endpoint /api/auth/claude-code/start which creates a cloud sandbox (running on E2B infrastructure) for your session (src/main/lib/trpc/routers/claude-code.ts:174-195).

    The error message (Failed to start VM 8lfjd8: Sandbox not found) indicates the server attempted to start a VM with ID 8lfjd8 but the sandbox resource could not be located — this is a server-side/infrastructure issue, not a client-side bug.

    Relevant code path

    1. User initiates sign-up → startAuth mutation fires (claude-code.ts:178)
    2. Desktop app sends POST to {apiUrl}/api/auth/claude-code/start with the desktop token
    3. Server creates a sandbox and returns { sandboxId, sandboxUrl, sessionId }
    4. If sandbox creation fails, the error propagates back to the desktop UI

    Not a duplicate

    The two previously closed sandbox-related issues are unrelated:

    Possible causes

    • Transient infrastructure issue: The E2B sandbox backend may have been temporarily unavailable or the specific VM template was not found
    • Account provisioning timing: If the Claude Code Max subscription was just initiated, the sandbox quota/allocation may not have been fully provisioned yet
    • Region/availability: Sandbox availability may vary by region

    Suggested workarounds

    1. Retry: Close and reopen the app, then try the sign-up flow again — the sandbox provisioning may have been a transient failure
    2. Check subscription status: Verify that the Claude Code Max subscription completed successfully on the billing side before retrying
    3. Clear app state (if retries fail):
      # macOS
      rm -rf ~/Library/Application\ Support/Agents\ Dev/
      # Then restart the app

    For maintainers

    This likely needs investigation on the server/infrastructure side (the /api/auth/claude-code/start endpoint and E2B sandbox provisioning). The desktop app is correctly surfacing the error from the backend — no client-side code change would resolve this.

  5. 21st-connector commented on Apr 29, 2026

    @21st-connector
    Contributor

    Issue Analysis

    What's happening

    The error "Failed to start VM: Sandbox not found" originates from the server-side sandbox creation during the Claude Code OAuth flow. When you select "Claude Code Max" as your billing method during onboarding, the app calls the 21st.dev backend (/api/auth/claude-code/start) to spin up a temporary CodeSandbox VM that handles the Anthropic OAuth exchange. The error indicates that the server-side sandbox (VM 8lfjd8) either failed to provision or was not found by the orchestration layer.

    Relevant code path

    1. Onboarding UI triggers startAuth mutation on mount — src/renderer/features/onboarding/anthropic-onboarding-page.tsx:92
    2. tRPC router calls the 21st.dev API to create the sandbox — src/main/lib/trpc/routers/claude-code.ts:174-196
    3. If the API returns a non-2xx response, the error is thrown at claude-code.ts:188 and surfaced in the UI via the onError callback at anthropic-onboarding-page.tsx:101-106

    The actual sandbox provisioning happens on the 21st.dev server, not in the desktop app. The desktop app simply forwards the request and displays the result.

    Root cause

    This is a server-side infrastructure issue, not a client-side bug. The "Sandbox not found" error suggests one of:

    • The CodeSandbox/E2B VM provisioning service returned an error or was temporarily unavailable
    • The sandbox 8lfjd8 was created but terminated or became unreachable before the client could poll it
    • A transient infrastructure issue on the 21st.dev backend

    Not a duplicate

    Previously closed sandbox-related issues (#103 and #31) are unrelated:

    Suggested workaround

    1. Retry — Click the "Connect" button again or restart the onboarding flow. The sandbox provisioning is often transient.
    2. Use API key instead — Go back to the billing method selection and choose "API Key" to bypass the sandbox-based OAuth flow entirely. You can use an Anthropic API key from console.anthropic.com.

    For maintainers

    Some improvements that could help with this class of errors:

    • Better error messaging: The raw "Failed to start VM: Sandbox not found" is opaque to users. The startAuth error path at claude-code.ts:188 could surface a more actionable message (e.g., "Authentication service temporarily unavailable, please retry").
    • Automatic retry with backoff: The startAuth mutation in the onboarding page fires once on mount. Adding retry logic (e.g., 2-3 attempts with exponential backoff) before showing an error would improve resilience.
    • Server-side investigation: Check the 21st.dev backend logs for sandbox 8lfjd8 to determine why it was not found — provisioning failure, timeout, or infrastructure issue.

    🤖 Generated with Claude Code

  6. heyalbert commented on Apr 29, 2026

    @heyalbert
    Author

    #Retry: Close and reopen the app, then try the sign-up flow again — the sandbox provisioning may have been a transient failure
    Check subscription status: Verify that the Claude Code Max subscription completed successfully on the billing side before retrying
    Clear app state (if retries fail):

    macOS

    rm -rf ~/Library/Application\ Support/Agents\ Dev/

    Then restart the app

    Tried this. Keeps failing. Active Claude Code subscription. Claude Code with Max subscription works in terminal.
    This is a new 1Code user account.

  7. heyalbert commented on May 4, 2026

    @heyalbert
    Author

    Update. New error message when trying to authenticate with Claude: Failed to start auth: Bad Gateway.
    Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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