Skip to content

fix: match NOT_LISTENING_ERROR against local-dev runtime message#230

Open
juanibiapina wants to merge 2 commits into
cloudflare:mainfrom
juanibiapina:fix/not-listening-error-string
Open

fix: match NOT_LISTENING_ERROR against local-dev runtime message#230
juanibiapina wants to merge 2 commits into
cloudflare:mainfrom
juanibiapina:fix/not-listening-error-string

Conversation

@juanibiapina

@juanibiapina juanibiapina commented Jun 22, 2026

Copy link
Copy Markdown

Problem

The isNotListeningError helper uses .toLowerCase().includes(matchingString) to detect the error. In production the runtime returns:

The container is not listening in the TCP address 10.0.0.1:8080

In local dev (wrangler dev) the runtime returns:

container is not listening on TCP address ...

The current constant 'the container is not listening' is not a substring of the local-dev variant (which omits the leading "the"), so isNotListeningError never returns true. The readiness loop in waitForPort / startAndWaitForPorts retries indefinitely and the Durable Object blocks forever.

Fix

Shorten the constant from 'the container is not listening' to 'container is not listening'. This is a substring of both variants, so the .includes() check works in both environments.

Environment

macOS 26.5.1 (arm64, Apple Silicon)
Node:      v24.15.0
pnpm:      10.21.0
wrangler:  4.103.0
@cloudflare/containers: 0.3.7
Docker:    29.4.0 (via OrbStack 2.2.1, kernel 7.0.11-orbstack)

Not sure whether the Docker runtime (OrbStack vs Docker Desktop) matters for this particular issue. Mentioning it in case it is relevant.

The isNotListeningError helper uses .includes() to detect the error.
In production the runtime returns 'The container is not listening in
the TCP address ...', but in local dev (wrangler dev) it returns
'container is not listening ...' without the leading 'the'. The
current constant 'the container is not listening' is not a substring
of the local-dev variant, so the readiness loop never recognises the
error and retries indefinitely.

Shorten the constant to 'container is not listening' so it matches
both variants.
@juanibiapina juanibiapina requested a review from a team as a code owner June 22, 2026 09:19
Add a unit test that mocks the local-dev error message (without the
leading 'the') and asserts doStartContainer returns immediately
instead of retrying. The test counts fetch calls: 2 with the fix
(recognised on first try), 3 without (falls through to retry).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant