Skip to content

Error: There is no container instance that can be provided to this Durable Object, try again later #45

Open

Description

@alexander-zuev

Issue Summary

Container instances are not available on production Cloudflare Workers account, causing all container-related operations to fail with error: "There is no container instance that can be
provided to this Durable Object, try again later"

Environment Details

  • Account: Production Cloudflare Workers account (can share per request)
  • Wrangler Version: 4.23.0
  • Container Config: instance_type: "dev" with @cloudflare/containers SDK
  • Deployment: Working locally and in tutorial examples, failing in production

Error Details

ERROR: There is no container instance that can be provided to this Durable Object, try again later

Configuration wrangler.jsonc:

  {
    "containers": [{
      "name": "code-container",
      "class_name": "CodeContainerDO",
      "image": "./Dockerfile",
      "instance_type": "dev"
    }],
    "durable_objects": {
      "bindings": [{
        "class_name": "CodeContainerDO",
        "name": "CODE_PORTABLE"
      }]
    }
  }

Steps to Reproduce

  1. Deploy worker with container configuration
  2. Call any endpoint that uses containerDO.start()
  3. Observe error in logs

Expected Behavior

Container should start successfully as it does in tutorial examples and local development.

Current Status

  • ✅ Image builds and and runs locally, container starts and is available
  • ✅ Works in tutorial account/setup
  • ✅ Worker deploys & builds successfully
  • ❌ Container runtime unavailable in production

Activity

  1. alexander-zuev commented on Jul 7, 2025

    @alexander-zuev
    Author

    Container image runs locally
    Image

    In prod they fail with the error described above and never start

    Image
  2. mikenomitch commented on Jul 7, 2025

    @mikenomitch
    Contributor

    Hey @alexander-zuev,

    I think this might be an issue where "max_instances" being unset accidentally defaults it to 0, and then you "hit your limit" before any are deployed.

    I'd try with a max_instances of 10 and see if it resolves. - Note that it'll take a little bit on first deploy to prep your containers, so wait until you don't see "provisioning" in the Container index of the UI.

    We've got a fix coming for max_instances and nicer UI + errors here if you do hit the limit.

    If that's not it, let me know and we can debug more!

  3. alexander-zuev commented on Jul 8, 2025

    @alexander-zuev
    Author

    Hey @mikenomitch! Thanks for the Discord response about container issues - I tried your suggestion to add max_instances but unfortunately it didn't resolve the problem.

    Quick Context: Building https://claudeportable.dev, which allows users to run Claude Code from Slack. The full flow works locally but fails in production due to container startup issues.

    Core Issue: Intermittent container provisioning failures with the error:
    Error: There is no container instance that can be provided to this Durable Object, try again later

    What I've Tested:

    1. ✅ Created minimal test container (297MB FastAPI vs 1.26GB main container) - same issue
    2. ✅ Added max_instances: 5 per your suggestion - no improvement
    3. ✅ Implemented proper manual start pattern with lifecycle hooks
    4. ✅ Verified containers work locally with Docker

    IDs:

    • basic-test-container: a0371fca-5bab-4bc6-8923-787d6282f468 (deleted)
    • claude-code-container: a03db2e8-6c9f-4183-b8b1-06727249bf29

    Error summary

    Experiencing intermittent container startup failures when deploying a test container to Cloudflare Workers. The container fails with "There is no container instance that can be
    provided to this Durable Object" errors, but occasionally succeeds after multiple retries.

    Issue Description

    Error Pattern (from latest logs):

    • Container fails to start ~80% of the time
    • Multiple consecutive failures, then occasionally succeeds
    • When it fails: "no container instance" → "not listening on TCP" → "blockConcurrencyWhile() timeout"
    • When it succeeds: Normal startup sequence and works perfectly

    Key Observations:

    • Issue affects both large (1.26GB) and small (297MB) containers equally
    • Success rate is unpredictable - sometimes works after 10+ retries
    • When successful, containers perform flawlessly
    • Exit codes 137/143 suggest container termination during startup

    Setup Details

    Architecture

    • Main Container: Claude Code SDK container (1.26GB)
    • Test Container: Basic FastAPI container (297MB)
    • Both use Cloudflare Container API with Durable Objects
    • Manual start pattern with per-instance environment variables

    Configuration (wrangler.jsonc)

      {
        "containers": [
          {
            "name": "claude-code-container",
            "class_name": "ClaudeCodeContainerDO",
            "image": "./Dockerfile",
            "instance_type": "basic",
            "max_instances": 1
          },
          {
            "name": "basic-test-container",
            "class_name": "BasicTestContainerDO",
            "image": "./basic_container/Dockerfile",
            "instance_type": "basic",
            "max_instances": 1
          }
        ]
      }

    What We Tried

    1. Created Minimal Test Container
    • Built a simple FastAPI container (297MB vs 1.26GB)
    • Basic endpoints: /, /health, /basic-test/{id}
    • Minimal dependencies to rule out size/complexity issues
    1. Implemented Manual Start Pattern
      // BasicTestContainerDO.ts
      export class BasicTestContainerDO extends Container {
        manualStart = true;
        defaultPort = 8080;
        sleepAfter = "5m";
        enableInternet = true;
    
        override async onStart(): Promise<void> {
          await this.ctx.storage.put('containerReady', true);
        }
      }
    1. Route Implementation
      app.get('/basic-test/:id', async c => {
        const container = c.env.BASIC_TEST_CONTAINER.get(containerId);
    
        await container.start({
          envVars: {
            CONTAINER_TYPE: "basic-test",
            MESSAGE: `Hello from container ${id}!`,
            TEST_ID: id
          }
        });
    
        return await container.fetch(c.req.raw);
      });
    1. Container Health Checks
    • Container exposes /health endpoint
    • FastAPI starts on port 8080
    • Verified locally with Docker
  4. alexander-zuev commented on Jul 8, 2025

    @alexander-zuev
    Author

    UPD: Implemented retry logic which wraps .start()- still experiencing 100% failure rate

    What I added:

    • Exponential backoff retry mechanism (5 attempts: 500ms → 1s → 2s → 4s → 8s)
    • Enhanced error logging to capture error structure
    • Discovered errors have remote property indicating infrastructure-level failures

    Latest production logs show consistent pattern:
    1:32:49 PM - GET /test-container
    Attempt 1: Failed after 4.5s - Error properties: ["stack", "message", "remote"]
    Attempt 2: Failed after 4.5s - Error properties: ["stack", "message", "remote"]
    Attempt 3: Failed after 4.5s - Error properties: ["stack", "message", "remote"]
    Attempt 4: Failed after 4.5s - Error properties: ["stack", "message", "remote"]
    Attempt 5: Failed after 4.5s - Error properties: ["stack", "message", "remote"]
    Result: All retry attempts exhausted

    Key findings:

    1. The remote property on errors confirms this is a platform-level issue
    2. Each attempt fails after ~4.5 seconds (likely internal timeout)
    3. Retry logic is working correctly but cannot overcome infrastructure unavailability
    4. Same behavior with both 297MB test container and 1.26GB production container

    Current impact: 100% failure rate for container provisioning in production. The retry mechanism confirms containers are consistently unavailable rather than experiencing transient
    failures.

    Logs:

    ClaudeCodeContainerDO.start - Ok @ 7/8/2025, 1:33:05 PM
      (warn) Error checking if container is ready: There is no container instance that can be provided to this Durable Object, try again later
      (warn) Error checking if container is ready: There is no container instance that can be provided to this Durable Object, try again later
    ✘ [ERROR]   Error: There is no container instance that can be provided to this Durable Object, try again later
    
    
    ✘ [ERROR]   Error: There is no container instance that can be provided to this Durable Object, try again later
    
    
    Alarm @ 7/8/2025, 1:33:09 PM - Ok
      (warn) Error checking if container is ready: There is no container instance that can be provided to this Durable Object, try again later
    ✘ [ERROR]   Error: There is no container instance that can be provided to this Durable Object, try again later
    
    
    Alarm @ 7/8/2025, 1:33:10 PM - Ok
    Alarm @ 7/8/2025, 1:33:15 PM - Ok
      (warn) Error checking if container is ready: There is no container instance that can be provided to this Durable Object, try again later
      (warn) Error checking if container is ready: There is no container instance that can be provided to this Durable Object, try again later
    ✘ [ERROR]   Error: There is no container instance that can be provided to this Durable Object, try again later
    
    
    ✘ [ERROR]   Error: There is no container instance that can be provided to this Durable Object, try again later
    
    
    Alarm @ 7/8/2025, 1:33:16 PM - Ok
      (warn) Error checking if container is ready: There is no container instance that can be provided to this Durable Object, try again later
      (warn) Error checking if container is ready: There is no container instance that can be provided to this Durable Object, try again later
    ✘ [ERROR]   Error: There is no container instance that can be provided to this Durable Object, try again later
    
    
    ✘ [ERROR]   Error: There is no container instance that can be provided to this Durable Object, try again later
    
    
    ClaudeCodeContainerDO.start - Ok @ 7/8/2025, 1:33:14 PM
      (warn) Error checking if container is ready: There is no container instance that can be provided to this Durable Object, try again later
      (warn) Error checking if container is ready: There is no container instance that can be provided to this Durable Object, try again later
    ✘ [ERROR]   Error: There is no container instance that can be provided to this Durable Object, try again later
    
    
    ✘ [ERROR]   Error: There is no container instance that can be provided to this Durable Object, try again later
    
    
    GET https://claude-code-portable.azuev.workers.dev/test-container - Ok @ 7/8/2025, 1:32:49 PM
      (log) [INFO] App - Test container route called
      (log) [INFO] Domain - User Claude config created | {"userId":"test-user-123","repoUrl":"https://github.com/alexander-zuev/supabase-mcp-server.git"}
      (log) [INFO] App - Starting container for test
      (log) [INFO] ContainerService:Domain - Starting container | {"userId":"test-user-123","repoUrl":"https://github.com/alexander-zuev/supabase-mcp-server.git"}
      (log) [INFO] ContainerService:Domain - Calling containerDO.start() with env vars | {"userId":"test-user-123","hasAnthropicKey":true,"hasGithubToken":true,"repoUrl":"https://github.com/alexander-zuev/supabase-mcp-server.git"}
      (log) [INFO] ContainerService:Domain - Attempting container start | {"userId":"test-user-123","attempt":1,"maxRetries":5}
      (error) [ERROR] ContainerService:Domain - containerDO.start() failed - detailed error analysis | {"userId":"test-user-123","attempt":1,"maxRetries":5,"errorType":"Error","errorMessage":"there is no container instance that can be provided to this durable object","errorString":"Error: there is no container instance that can be provided to this durable object","errorProperties":["stack","message","remote"],"isRetryable":true}
      (warn) [WARN] ContainerService:Domain - Retrying container start after delay | {"userId":"test-user-123","attempt":1,"nextAttempt":2,"delayMs":539}
      (log) [INFO] ContainerService:Domain - Attempting container start | {"userId":"test-user-123","attempt":2,"maxRetries":5}
      (error) [ERROR] ContainerService:Domain - containerDO.start() failed - detailed error analysis | {"userId":"test-user-123","attempt":2,"maxRetries":5,"errorType":"Error","errorMessage":"there is no container instance that can be provided to this durable object","errorString":"Error: there is no container instance that can be provided to this durable object","errorProperties":["stack","message","remote"],"isRetryable":true}
      (warn) [WARN] ContainerService:Domain - Retrying container start after delay | {"userId":"test-user-123","attempt":2,"nextAttempt":3,"delayMs":1014}
      (log) [INFO] ContainerService:Domain - Attempting container start | {"userId":"test-user-123","attempt":3,"maxRetries":5}
      (error) [ERROR] ContainerService:Domain - containerDO.start() failed - detailed error analysis | {"userId":"test-user-123","attempt":3,"maxRetries":5,"errorType":"Error","errorMessage":"there is no container instance that can be provided to this durable object","errorString":"Error: there is no container instance that can be provided to this durable object","errorProperties":["stack","message","remote"],"isRetryable":true}
      (warn) [WARN] ContainerService:Domain - Retrying container start after delay | {"userId":"test-user-123","attempt":3,"nextAttempt":4,"delayMs":2112}
      (log) [INFO] ContainerService:Domain - Attempting container start | {"userId":"test-user-123","attempt":4,"maxRetries":5}
      (error) [ERROR] ContainerService:Domain - containerDO.start() failed - detailed error analysis | {"userId":"test-user-123","attempt":4,"maxRetries":5,"errorType":"Error","errorMessage":"there is no container instance that can be provided to this durable object","errorString":"Error: there is no container instance that can be provided to this durable object","errorProperties":["stack","message","remote"],"isRetryable":true}
      (warn) [WARN] ContainerService:Domain - Retrying container start after delay | {"userId":"test-user-123","attempt":4,"nextAttempt":5,"delayMs":4054}
      (log) [INFO] ContainerService:Domain - Attempting container start | {"userId":"test-user-123","attempt":5,"maxRetries":5}
      (error) [ERROR] ContainerService:Domain - containerDO.start() failed - detailed error analysis | {"userId":"test-user-123","attempt":5,"maxRetries":5,"errorType":"Error","errorMessage":"there is no container instance that can be provided to this durable object","errorString":"Error: there is no container instance that can be provided to this durable object","errorProperties":["stack","message","remote"],"isRetryable":true}
      (error) [ERROR] ContainerService:Domain - All retry attempts exhausted | {"userId":"test-user-123","finalAttempt":5,"error":"Error: there is no container instance that can be provided to this durable object"}
      (error) [ERROR] ContainerService:Domain - Failed to start container | {"userId":"test-user-123","error":"Error: there is no container instance that can be provided to this durable object","stack":"Error: there is no container instance that can be provided to this durable object\n    at async _ContainerService.startContainerWithRetry (index.js:16876:29)\n    at async _ContainerService.startContainer (index.js:16938:7)\n    at async Array.<anonymous> (index.js:18880:5)"}
      (error) [ERROR] App - Test container failed | {"error":"Error: there is no container instance that can be provided to this durable object"}
    Alarm @ 7/8/2025, 1:33:17 PM - Ok
      (warn) Error checking if container is ready: There is no container instance that can be provided to this Durable Object, try again later
    ✘ [ERROR]   Error: There is no container instance that can be provided to this Durable Object, try again later
    
    
    Alarm @ 7/8/2025, 1:33:18 PM - Ok
  5. alexander-zuev commented on Jul 8, 2025

    @alexander-zuev
    Author

    UPD2: I've tried trimming down docker image from 1200MB to 700MB but it didn't solve the issue. Not sure if image size plays a role (but a smaller test container was eventually run). I am not sure I can cut size any further though

  6. mikenomitch commented on Jul 8, 2025

    @mikenomitch
    Contributor

    @alexander-zuev thanks for all the updates and the app ID. We'll take a look and see if there's something we can learn in our logs.

    Really appreciate the details!

  7. alexander-zuev commented on Jul 17, 2025

    @alexander-zuev
    Author

    Hey, @mikenomitch - just checking if there is any workaround / news on the above that I could try to resolve this issue? Really appreciate your help!

  8. lee90-creator commented on Aug 6, 2026

    @lee90-creator

    We are seeing the same production-only placement failure on two independent
    Container applications in one account.

    Environment:

    • Wrangler 4.114.0
    • @cloudflare/containers 0.3.7
    • immutable image digest that initially served successful health/application
      requests
    • explicit max_instances on both applications

    Original application:

    • application ID: a033d3c3-79fe-40ea-8824-b51d95ab0d5d
    • max instances: 2
    • three fresh Durable Object names tested

    Independent canary application:

    • application ID: a037396d-4ce3-4f65-b621-baafd0b071c2
    • separate Container class and SQLite Durable Object namespace
    • max instances: 1
    • no location hint
    • same immutable image

    Both applications reach ready, but requests return either:

    Failed to start container: undefined
    

    or:

    Failed to start container: The container is not running, consider calling start()
    

    For both applications, the read-only dashboard instances API returns
    success=true and instances=[]. Durable Object rows contain id and name
    but no deployment_id or placement_id; Wrangler consequently shows them as
    inactive with unknown location/version.

    We also tested:

    • raising the original application to max_instances: 4;
    • fresh Durable Object identities;
    • removing the APAC location hint;
    • the 0.3.7 concurrent-start and stale-state fixes;
    • explicit start and bounded retry experiments; and
    • a genuinely separate application/namespace.

    None received a deployment attachment. The diagnostic retry/routing changes
    were removed; the separate application is retained inert for provider
    inspection.

    Could a maintainer inspect account-side scheduler/placement logs for the two
    application IDs above? I can provide the account ID privately if needed.

  9. lee90-creator commented on Aug 9, 2026

    @lee90-creator

    Update with a third affected production application after a fully verified cutover:

    • exact release SHA: 92ff1d4b329cc98e4b3fdb2297fea1b450f4784e
    • CI: https://github.com/lee90-creator/anjwa-land-dashboard/actions/runs/31321654919 (backend, frontend, land-api, dev2-api all successful)
    • production application ID: a03db4fb-1258-490e-9854-f13ebfa9dc30
    • immutable image: kch-land-runtime@sha256:92651e191260f33bd644ef37109b13331fa6131eab8e52931a94ebd5b728e594
    • application API: version 2, healthy: 1, no reported errors
    • actual instance a6e180d04abde534623cb2f3b9bded616df4934d12cc917912f3b2f5fb4a4197: inactive, location: null, version: null
    • wrangler containers ssh returns Instance ... not found

    The same image/config is also attached to the two dev2 applications from the previous comment; fresh named Durable Objects still become inactive without location/version. Wrangler 4.120.0 JSON output confirms the same state, and releases 4.115–4.120 contain no scheduler/startup fix.

    This now reproduces across three applications/namespaces, including the production application. Could a maintainer inspect account-side placement/deployment-attachment logs for these application IDs?

  10. humanonlytenzeros commented on Nov 11, 2026

    @humanonlytenzeros

    Also getting this repeatedly when deploying with cf at a frustratingly high rate, maybe one in 3 ci jobs. Is fixing this on the roadmap?

    We love cloudflare and are willing to tolerate hiccups if we have some timeline we can plan around. Thanks for making an awesome tool!!

    
    "node_modules/@cloudflare/containers": {
          "version": "0.3.7",
          "resolved": "https://registry.npmjs.org/@cloudflare/containers/-/containers-0.3.7.tgz",
          "integrity": "sha512-DM9dm3FnIBSyiSJ1FLavKwl/lk3oAmTaynCzZQ9pZR0ncRPquSxkxd8Nu2MFILxmDDsPkxKsSNEh9mHHMty4Fw==",
          "license": "MIT OR Apache-2.0"
        },
    
    "node_modules/cf": {
          "version": "1.0.0-beta.26",
          "resolved": "https://registry.npmjs.org/cf/-/cf-1.0.0-beta.26.tgz",
          "integrity": "sha512-StQUwvWubehIWMTqlUbfRNuUgO9qzE4ns7AMa0NbE2eJrOV32E9DwZxfxhqu4aADbE9kKXOt/XuqDC3mM3gC3w==",
          "dev": true,
          "license": "MIT OR Apache-2.0",
          "dependencies": {
            "@cloudflare/build-output-utils": "0.9.6",
            "@cloudflare/config": "0.29.0",
            "@cloudflare/runtime-types": "0.1.19",
            "blake3-wasm": "2.1.5",
            "miniflare": "5.20261023.3-beta"
          },
    
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