Skip to content

Exit code 126 (permission denied) - Moltbot gateway fails to start #64

@prapoport

Description

@prapoport

Issue Description

The Moltbot gateway process fails to start with exit code 126 (permission denied). This differs from the exit code 127 reported in #47.

Environment

  • Worker name: botoport-worker
  • Deployment method: npm run deploy
  • Platform: Windows 11, Docker Desktop
  • Cloudflare Workers: Paid plan with Sandbox Containers enabled

Configuration Status

All configuration is complete and verified:

  • ✅ AI Gateway configured with Anthropic API key
  • ✅ R2 storage configured (Access Key ID, Secret Access Key, Account ID)
  • ✅ Cloudflare Access configured with proper authentication
  • ✅ All required secrets set (ANTHROPIC_API_KEY, MOLTBOT_GATEWAY_TOKEN, CF_ACCESS_TEAM_DOMAIN, CF_ACCESS_AUD, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, CF_ACCOUNT_ID)
  • ✅ Browser Rendering enabled

What I've Tried

  • Deploying with npm run deploy and npx wrangler deploy
  • Enabling/disabling DEV_MODE
  • Configuring Cloudflare Access (both manual and automatic methods)
  • Setting both MOLTBOT_GATEWAY_TOKEN and CLAWDBOT_GATEWAY_TOKEN (legacy name)
  • Restarting the gateway multiple times via admin UI

Additional Context

The admin UI at /_admin/ loads successfully and shows:

  • R2 storage is properly configured (green status)
  • Gateway restart button is available but produces the same error
  • Container appears to be running but the Moltbot process itself cannot execute

Exit code 126 specifically indicates "Permission denied" on Linux, suggesting the Moltbot binary in the Cloudflare Sandbox container lacks execute permissions or is encountering a permission issue when trying to bind to port 18789.

Expected Behavior

The Moltbot gateway should start successfully and listen on port 18789.

Logs

The wrangler tail shows the container is running with multiple processes, but the gateway process consistently exits with code 126 before becoming ready.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions