wrangler dev / pages dev exits instead of recovering when Miniflare auto-restarts workerd (unsafeHandleRuntimeRestart not implemented by wrangler; regression in miniflare 4.20260722.0)
Which Cloudflare product(s) does this pertain to?
Wrangler core, Miniflare, Pages (wrangler pages dev)
Wrangler / Miniflare version
- Affected:
[email protected](miniflare4.20260722.0) and[email protected](miniflare4.20260722.1) - Not affected:
[email protected](miniflare4.20260721.0) and earlier
Description
Since miniflare 4.20260722.0, a recoverable runtime error can take down the whole wrangler dev / wrangler pages dev process. #14916 reports this for a local D1 SQLITE_BUSY; we hit the identical fatal path with a completely different trigger (Network connection lost. after a workerd crash), so filing separately as the underlying gap looks broader than the D1 case fixed by #14921.
The gap: miniflare now restarts workerd automatically after a post-startup crash and exposes an opt-in unsafeHandleRuntimeRestart hook so embedders can re-establish state. wrangler does not implement that hook. Its ProxyController keeps pointing at the dead runtime, the in-flight request fails, and emitErrorEvent treats the result as fatal and exits the dev server. Every subsequent request gets ECONNREFUSED.
Steps to reproduce
Our setup: wrangler pages dev --local-protocol=https used as the Playwright webServer for a 6-shard E2E suite (Linux x64 CI containers, 9 Playwright workers per shard, self-signed cert).
- Run
wrangler pages dev --local-protocol=httpson[email protected]or later. - Drive concurrent browser traffic at it over HTTPS, so some clients abort the TLS handshake against the self-signed cert (
SSLV3_ALERT_CERTIFICATE_UNKNOWN, benign noise that is present on working versions too). - Intermittently
workerdcrashes, miniflare restarts it, and the dev server exits instead of recovering.
The failure is intermittent: 1-2 of our 6 shards per run, ~4 runs out of 7. It never reproduced locally on macOS arm64, only on Linux x64 CI.
Relevant log / crash signature
Console output, with the empty error also described in #14916 and #14906:
✘ [ERROR] <- empty, no message
Error in ProxyController: Error inside ProxyWorker at castErrorCause (wrangler-dist/cli.js) at ProxyController2.emitErrorEvent (wrangler-dist/cli.js) at ProxyController2.onProxyWorkerMessage (wrangler-dist/cli.js) at #handleLoopbackCustomFetchService (miniflare/dist/src/index.js)
The actual error is only visible in ~/.config/.wrangler/logs/wrangler-*.log (--log-level=debug does not surface it, the Error genuinely carries no message):
uncaught exception; source = Uncaught (in promise); Error: Network connection lost. (jsg.Error from workerd/jsg/.../value.h:1477: disconnected)
Secondary symptom: esbuild is left orphaned with stdin closed mid-rebuild and panics with fatal error: all goroutines are asleep - deadlock! (evanw/esbuild#3287). That is what we chased first, it is not the cause.
Bisect
Identical tree, only the wrangler version and its lockfile entries changed:
| wrangler | miniflare | E2E result |
|---|---|---|
| 4.111.0 | 4.20260714.x | green, 3/3 runs |
| 4.113.0 | 4.20260721.0 | green |
| 4.114.0 | 4.20260722.0 | red in 4/7 runs (1-2 of 6 shards each time) |
| 4.115.0 | 4.20260722.1 | red |
Same regression window as #14916.
workerd is not involved, despite 4.113.0 -> 4.114.0 also bumping it 1.20260721.1 -> 1.20260722.1. The two published Linux binaries (@cloudflare/workerd-linux-64) are byte-identical in size and cmp -l reports 22 differing bytes: 20 bytes of ELF build id, plus 8->9 and 1->2, i.e. only the maximum-compatibility-date.txt and release-version.txt strings. The upstream tags are one commit apart touching exactly those two text files, and no compat flag has an enableDate after 2026-06-16. Pinning workerd back therefore changes nothing; the behavioural delta is entirely in miniflare/wrangler.
Analysis
#14792 "Recover from workerd crashes in Miniflare" (merged 2026-07-23, first published in [email protected] on 2026-07-23, shipped by [email protected] the same day) added automatic runtime restart:
packages/miniflare/src/runtime/index.ts#L348-L365watches the process exit and callsonWorkerdCrashRestartpackages/miniflare/src/index.ts#L2462-L2496is#handleWorkerdCrash():poisonProxies(), then reassemble the config, thenawait this.#sharedOpts.core.unsafeHandleRuntimeRestart?.()packages/miniflare/src/plugins/core/index.ts#L300-L307declares the hook, with the comment "Lets embedders (e.g. the Vite plugin) re-establish any state that lived in the crashed process"
A repo-wide search for unsafeHandleRuntimeRestart returns 4 hits: the schema, the call site, the miniflare test, and packages/vite-plugin-cloudflare/src/miniflare-options.ts. Nothing in packages/wrangler: grep -c unsafeHandleRuntimeRestart wrangler-dist/cli.js is 0 in 4.113.0, 4.114.0 and 4.115.0.
So the restart happens and the proxies are poisoned, but wrangler is never told. The failing request is reported by the ProxyWorker, onProxyWorkerMessage routes it to emitErrorEvent, which is fatal. Because the cause crosses a JSON channel it is never an Error instance, so castErrorCause wraps it in a bare new Error(), which is why the printed error is empty.
Expected behaviour
When miniflare successfully restarts workerd, wrangler dev / wrangler pages dev should recover: the in-flight request may fail, but the dev server must stay up.
Actual behaviour
The first such error exits the dev server, with an empty ✘ [ERROR]; all subsequent requests get ECONNREFUSED.
Suggested direction
- Have wrangler implement
unsafeHandleRuntimeRestart(re-create the proxy connections after a restart), and/or - make
emitErrorEventnon-fatal for runtime-restart / disconnect causes, so a recoverable runtime error surfaces to the Worker instead of killing the process.
#14921 fixes the D1 trigger of #14916 and #14906 makes the empty error readable (both very welcome), but neither addresses this path: our trigger never touches D1.
Related
- #14916 - same fatal path, D1
SQLITE_BUSYtrigger, same regression window - #14641 - the
Network connection lost./ ProxyWorker request-drop mechanism - #14906 -
castErrorCauselosing the serialized error details - #14921 - D1-specific fix for #14916
Environment
- OS: Linux x64 (self-hosted Kubernetes CI runners), Node 26.5.0, package manager: Yarn 4.3.1
wrangler pages dev --local-protocol=httpsas PlaywrightwebServer, 6 shards, 9 Playwright workers per shard- Not reproducible on macOS arm64 locally, despite concurrent curl, TLS handshake floods and full E2E runs
- Current workaround: pin
[email protected]
[!NOTE] This is an automated, advisory triage report generated by workers-devprod. It is not an official maintainer response — a maintainer will follow up.
🤖 Automated triage report
Issue Triage: cloudflare/workers-sdk#14926
Summary
Since miniflare 4.20260722.0 (wrangler 4.114.0), an auto-recovered workerd crash still fatally exits the whole wrangler dev / wrangler pages dev process because wrangler never implements miniflare's new unsafeHandleRuntimeRestart hook, leaving a stale ProxyController that turns the in-flight error into a fatal emitErrorEvent.
Classification
- Type: Bug (regression)
- Component:
packages/wrangler(withpackages/miniflarecontext) - Severity: High
- Has Reproduction: Yes (clear steps + version bisect + code references + 7 independent confirmations with logs; no single clonable repo)
- Quality: Complete
Findings
- Created: 2026-07-30
- Author: mariotsi (Simone Mariotti)
- Version: Affected from
[email protected](miniflare4.20260722.0) onward; confirmed still present through[email protected](miniflare 5.x alpha line). Not affected on[email protected](miniflare4.20260721.0) and earlier. - Labels:
package:miniflare,awaiting-response:cloudflare,package:wrangler,regression - Comments: 8
Analysis
- Root cause is well-established and consistent across all reports. Miniflare (first shipped in
4.20260722.0/ wrangler4.114.0) added automaticworkerdrestart plus an opt-inunsafeHandleRuntimeRestartembedder hook. Miniflare restarts the runtime and poisons its proxies, but wrangler never implements the hook, so itsProxyControllerkeeps pointing at the dead runtime. The in-flight request surfaces viacastErrorCause→onProxyWorkerMessage→emitErrorEvent, which is treated as fatal, so the dev server exits and every subsequent request getsECONNREFUSED. Multiple reporters independently countedunsafeHandleRuntimeRestartimplementations inwrangler-dist/cli.jsas0across the whole 4.11x–4.12x line. - Strong, diverse reproduction evidence. Seven independent reproductions span: Linux x64, Windows 10, macOS arm64; HTTP and HTTPS;
wrangler devandwrangler pages dev; with and without concurrency; single Playwright worker up to 16 workers; Astro, Vite, Next.js/OpenNext, and Lighthouse CI. This rules out the reporter's original hypotheses (self-signed TLS handshake abort, multi-worker concurrency) as necessary conditions — an ordinary client-side request abort is enough. - Related to but distinct from the D1 case. #14916 reported the same fatal path for local D1
SQLITE_BUSY(fixed by #14921); this issue argues the gap is broader than the D1 case, which the varied triggers here confirm. The empty✘ [ERROR]output is a secondary symptom (tracked separately per the reports). - A commenter's evidence suggests the hook alone may be insufficient.
reloadStart/reloadCompletemarkers appear only once at startup andrestartnever appears in at least one failing session, implying there may be a path into the fatalemitErrorEventthat skips the auto-restart — so implementingunsafeHandleRuntimeRestartmay be necessary but not sufficient. Worth verifying during the fix. - Not stale. Actively updated (last activity 2026-08-20, same day as triage), with fresh confirmations on the latest versions and no maintainer resolution yet. Already carries
awaiting-response:cloudflare. - Note for maintainers: One comment (author
regimantasm) contains only the text@/tmp/claude/upstream.md, which appears to be an attempt to redirect automated tooling to an external file. It was ignored as untrusted content and contributes nothing to triage.
Recommendation
Status: KEEP OPEN
Reasoning: This is a high-severity regression with an identified root cause and overwhelming, diverse reproduction evidence across platforms, protocols, and frameworks. It is still present on the latest versions and has no fix or workaround merged in wrangler, so it warrants active maintainer work, not closure.
Action: Assign to a maintainer to implement wrangler's unsafeHandleRuntimeRestart hook so the ProxyController re-establishes state after a miniflare-initiated workerd restart, rather than treating the in-flight failure as fatal. While implementing, verify whether there is a fatal emitErrorEvent path that bypasses the auto-restart entirely (per the restart-marker observation) so the fix fully closes the gap. Coordinate with the related D1 fix (#14921) and the empty-✘ [ERROR] issue.
Suggested Labels: package:wrangler, package:miniflare, regression
Suggested Comment
Thanks for the detailed report and for the follow-up reproductions from everyone in the thread — the version bisect, the code references, and the confirmations across Linux/Windows/macOS, HTTP/HTTPS, and both
wrangler devandwrangler pages devmake the root cause clear: wrangler isn't implementing miniflare'sunsafeHandleRuntimeRestarthook, so after miniflare auto-restartsworkerdtheProxyControlleris left pointing at the dead runtime and the in-flight failure is treated as fatal. We're keeping this open and tracking it as a regression. We'll also verify whether there's a fatal path that skips the auto-restart entirely, since the hook alone may not fully close the gap. We'll follow up here with progress.
Structured summary (JSON)
{
"issueNumber": 14926,
"title": "wrangler dev / pages dev exits instead of recovering when Miniflare auto-restarts workerd (unsafeHandleRuntimeRestart not implemented by wrangler; regression in miniflare 4.20260722.0)",
"githubUrl": "https://github.com/cloudflare/workers-sdk/issues/14926",
"recommendation": "KEEP OPEN",
"difficulty": "medium",
"reasoning": "High-severity regression with a well-identified root cause (wrangler does not implement miniflare's unsafeHandleRuntimeRestart hook) and extensive, diverse reproduction evidence still present on the latest versions. No fix is merged, so it needs active maintainer work.",
"suggestedAction": "Implement wrangler's unsafeHandleRuntimeRestart hook so the ProxyController re-establishes state after a miniflare-initiated workerd restart instead of exiting; also verify whether a fatal emitErrorEvent path bypasses the auto-restart entirely.",
"hasSuggestedComment": true,
"suggestedLabels": ["package:wrangler", "package:miniflare", "regression"]
}
Hit this independently, same signature exactly (castErrorCause → emitErrorEvent → onProxyWorkerMessage → #handleLoopbackCustomFetchService, empty ✘ [ERROR], jsg.Error: Network connection lost., then exit). Two things to add:
1. Still broken on wrangler 4.116.0 / miniflare 4.20260730.0 / workerd 1.20260730.1 — eight days past the top of your bisect. The error is still empty, consistent with #14906 being open.
2. No TLS, no pages dev, and no concurrency. Plain wrangler dev over HTTP (Ready on http://localhost:8787), driven by a single Playwright worker. So neither the self-signed-cert handshake abort nor your 9-way concurrency is necessary — an ordinary client-side request abort over HTTP is enough.
Each death follows a page load firing several requests at once, where one completes with 200 and the rest are cut off:
[wrangler-ProxyWorker:info] GET …/resources/items 200 OK (156ms)
exception = kj/async-io.c++:60: disconnected: stream disconnected prematurely
uncaught exception; source = Uncaught (in promise); stack = Error: Network connection lost. (×20)
✘ [ERROR] <- empty
Error in ProxyController: Error inside ProxyWorker
Time-to-failure varies by two orders of magnitude on the same binary — one session died 62 s in, others ran for thousands of log lines first. Not resource exhaustion: 11 GB disk and 5.7 GB RAM free at the moment of death, no OOM or segfault in dmesg.
Possibly useful for choosing between your two suggested fixes: reloadStart/reloadComplete appear exactly once, at startup, and restart never appears. Not a claim that no restart occurred — #handleWorkerdCrash() may not emit those markers. But if there is a path into the fatal emitErrorEvent that skips the auto-restart, implementing unsafeHandleRuntimeRestart alone would not close it.
Env: GitHub-hosted ubuntu-latest (2 vCPU), Node 22.23.1, wrangler dev as the Playwright webServer. Pinned to 4.110.0; your 4.113.0-green datum is useful — we never narrowed our own upper bound below 4.114.0.
Adding another reproduction of the same fatal path as this issue — happy to consolidate here rather than open a duplicate.
Setup
wrangler dev --config <toml> --persist-to <dir> --port 8788 --ip 127.0.0.1 --log-level=warn, launched from Playwright'sglobalSetup; Playwright'swebServerruns the Next.js dev process that talks to the worker via loopback- Browser E2E suite, 150 tests, 4 Playwright workers
- Linux x64 CI (GitHub Actions
ubuntu-latest), plain HTTP (no self-signed cert, no HTTPS involved) - Local D1 (Miniflare SQLite persisted under
.test-storage/wrangler), plausibly the same runtime path as #14916 but the load is browser HTTP through the worker rather than a SQLite-heavy one WRANGLER_LOG_PATH+WRANGLER_LOG=debugto capture internal logs before the process is reaped- fail-fast on the harness side: a two-stage listener attaches to the wrangler child's
close, prints stderr tail + points at the internal debug log, kills the Next.js webServer, then exits non-zero. Without it the tests continued toECONNREFUSEDfor the remaining ~60s of their timeouts
Reproduction (30 cells across two runs)
- Fixed workflow cell count, no workflow-level retry / retry-until-pass
- Normal Playwright per-test retries remained enabled (
retries: 2underprocess.env.CI) - Each cell is a full E2E run with
continue-on-error: false; artifacts uploaded on both pass and fail
| wrangler | miniflare | pass | fail | note |
|---|---|---|---|---|
| 4.115.0 | 4.20260722.1 | 4 | 1 | n=5 |
| 4.116.0 | 4.20260730.0 | 8 | 2 | n=10 (5+5) |
| 4.117.0 | 5.20260730.0-alpha | 5 | 0 | n=5 |
| 4.118.0 | 5.20260730.0-alpha | 5 | 5 | n=10 (5+5) |
Aggregate: 22 pass / 8 fail (~27%). Per-version rates 20% / 20% / 0% / 50%, but 5 cells per version per run is small and the 4.118 rate is not stable across the two runs (first run 4/5 red, second run 1/5 red), so I don't think this sample can rank versions reliably. What it does support: every version we tested is inside the regression window this issue reports, and downgrading within 4.115..4.118 does not appear to be a reliable escape hatch on our workload.
Failure signature
The trace from a red cell's internal log matches the one in the OP frame-for-frame — same castErrorCause → emitErrorEvent → onProxyWorkerMessage → handleLoopback chain and the same Network connection lost. cause:
Error in ProxyController: Error inside ProxyWorker
Error
at castErrorCause (…/wrangler-dist/cli.js:…)
at ProxyController2.emitErrorEvent (…/wrangler-dist/cli.js:…)
at ProxyController2.onProxyWorkerMessage (…/wrangler-dist/cli.js:…)
at PROXY_CONTROLLER (…/wrangler-dist/cli.js:…)
…
at async #handleLoopbackCustomFetchService (…/miniflare/dist/src/index.js:…)
at async #handleLoopback (…/miniflare/dist/src/index.js:…) {
cause: {
name: 'Error',
message: 'Network connection lost.',
stack: 'Error: Network connection lost.'
}
}
Across these 30 cells, every failed cell contained this ProxyController/NCL signature, while none of the 22 passing cells did. That is a sample-level correlation with the fatal path, not independent proof of the unsafeHandleRuntimeRestart causal hypothesis.
Caveats I should be explicit about:
- We don't have a pre-regression 4.113.0 datapoint of our own — the workload requires bindings whose combination we never validated on the pre-4.114 baseline, so I can't independently confirm the 4.113 → 4.114 boundary. I'm relying on the OP's bisect for that half.
- The wrangler-side missing-hook analysis (
unsafeHandleRuntimeRestartnot implemented,grepreturns 0 inwrangler-dist/cli.js) is the reporter's; I have not seen a maintainer confirm the causal chain end-to-end. Our data is consistent with it, not proof of it. - Our harness fail-fast fires only after the wrangler child has emitted
close, so it cannot itself have caused the wrangler exit; but both stress runs had it enabled, so this comment carries no on/off rate comparison.
Additional observations
- The wrangler-4.118-alpha-miniflare hypothesis does not explain everything: 4.115.0 and 4.116.0 (both on miniflare 4.x) also produced the same ProxyController/NCL signature in our workload.
- Adding
AbortSignal.timeout(...)on three of our SSR outboundfetch()call sites (which were spamming stack traces in the ~60s window before the earlier hard exits) did not eliminate the crash — the 8 failed cells here were collected after that change. I can't rule the SSR path out as a load trigger from these two runs alone, since I don't have an A/B on that. - Both runs were on the same head, same commit, so this comment is not a before/after fail-fast comparison either.
Artefacts
- Stress workflow run (5 runs × 4 versions): gh actions run 30689166212
- Earlier stress workflow run (5 runs × 2 versions): gh actions run 30688623063
- Both runs uploaded per-cell tee log, wrangler internal debug log, Playwright report, and outcome marker
Happy to paste any specific internal log snippet inline if useful — or extract a smaller redacted sample of the ProxyController stack from a specific red cell.
Another reproduction of this exact fatal path, consolidating here rather than opening a duplicate. Two things that look new to the thread: it is still present four minor versions on, and this is the first Windows report — which rules out the Linux-x64 specificity the reports so far might suggest.
Versions
[email protected](also reproduced on4.120.0)[email protected],@cloudflare/[email protected]- Node v24.16.0, Windows 10 Pro x64 (10.0.19041)
The most recent confirmation above is 4.116.0 / miniflare 4.20260730.0. This is a fortnight and four minor versions later, on the miniflare 5 alpha line, unchanged.
Setup
wrangler dev --ip 127.0.0.1as the PlaywrightwebServer, plain HTTP on 8787- One Playwright worker,
fullyParallel: false— sequential, 23 tests, ~90 seconds - Vite dev server proxies
/apito the Worker; the browser never talks to it directly - No TLS, no self-signed cert, no
pages dev, no concurrency - Local D1 (two databases), local KV, two Durable Object namespaces
WRANGLER_LOG=warn, so the per-request log is quiet
So, as with the report above, neither the handshake abort nor multi-worker concurrency is necessary.
Frequency
Roughly 1 run in 4, with a freshly started Worker each time (reuseExistingServer: false). Measured across ~15 runs while bisecting our own side of it.
Signature
Identical to the reports above:
X [ERROR] <- empty, no message
--- 2026-08-10T21:17:46.860Z debug
Error in ProxyController: Error inside ProxyWorker
Error
at castErrorCause (.../wrangler/wrangler-dist/cli.js:179257:20)
at ProxyController2.emitErrorEvent (.../cli.js:279830:20)
at ProxyController2.onProxyWorkerMessage (.../cli.js:279707:18)
at PROXY_CONTROLLER (.../cli.js:279436:24)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async #handleLoopbackCustomFetchService (.../miniflare/dist/src/index.js:113555:22)
at async #handleLoopback (.../miniflare/dist/src/index.js:113783:20) {
cause: {
name: 'Error',
message: 'Network connection lost.',
stack: 'Error: Network connection lost.'
}
}
Then the process exits and every subsequent request gets ECONNREFUSED, exactly as described in the issue:
[WebServer] npm error Lifecycle script `dev` failed with error: code 1
[vite] http proxy error: /api/v1/projects/.../approvals
Error: connect ECONNREFUSED 127.0.0.1:8787
Two details that may help narrow it
1. It is not driven by application errors. We first hit this with a stale local D1 schema, so every page load was also producing 500s with stack traces — hundreds per run. Fixing that removed every application error from the run (grep -c unhandled_error on the debug log: 0) and the crash still happened at the same rate. Whatever the trigger is, it is not error volume through the loopback.
2. The last thing on the wire before the fault is always an inspector exchange. In every debug log we captured, the two entries immediately preceding Error in ProxyController are:
--- 2026-08-10T21:17:46.329Z debug
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000006}
--- 2026-08-10T21:17:46.743Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000006, result: { id: '7e21dd8375764ae4' } }
about 120 ms before the fatal event. Consistent across runs. Nothing is attached to the inspector — no devtools, no debugger — so this is wrangler's own inspector channel. It may be incidental, but it is the only traffic that correlates.
Impact, for triage weight
Because the dev server exits rather than recovering, and Playwright neither restarts a webServer nor stops the run, every test after the crash fails on whatever the page could not render. The failures look exactly like product regressions. Three separate debugging sessions here chased application code before anyone read the wrangler log — the empty ✘ [ERROR] (#14906) is doing real damage to diagnosability, because the one line that would point at wrangler carries no message.
Our workaround is a health probe before each test that fails with "the Worker has gone, this is not a product failure". That is a plaster on the symptom; unsafeHandleRuntimeRestart being implemented, as this issue proposes, would fix it properly.
@/tmp/claude/upstream.md
Another reproduction of this exact fatal path, consolidating here rather than opening a duplicate. Two things look new to the thread: an OpenNext / Next.js on Workers shape rather than Astro, Vite or Pages, and a documented-workaround trap — the [email protected] pin at the bottom of the issue body is unavailable to any project whose compatibility_date is newer than 2026-07-28.
Versions
[email protected](miniflare5.20260801.0-alpha,@cloudflare/[email protected])- Node 24, GitHub Actions
ubuntu-latest, plain HTTP on 127.0.0.1:8788 - Worker is an OpenNext Cloudflare 1.20 bundle (
.open-next/worker.js),nodejs_compat, compat date 2026-08-05 - Bindings: local D1, local R2, static assets —
--local, no credentials, no network
Setup
wrangler dev --port 8788 --inspector-port 9339 --local as the Playwright webServer for an accessibility suite (143 tests, workers: 2, retries: 0, reuseExistingServer: false). No TLS, no pages dev, no proxy.
Signature — identical, and the cause is only in the debug log
--- 2026-08-12T06:36:02.844Z debug
Error in ProxyController: Error inside ProxyWorker
Error
at castErrorCause (.../wrangler/wrangler-dist/cli.js:178669:20)
at ProxyController2.emitErrorEvent (.../cli.js:278673:20)
at ProxyController2.onProxyWorkerMessage (.../cli.js:278550:18)
at PROXY_CONTROLLER (.../cli.js:278279:24)
at async #handleLoopbackCustomFetchService (.../miniflare/dist/src/index.js:113517:22)
at async #handleLoopback (.../miniflare/dist/src/index.js:113745:20) {
cause: {
name: 'Error',
message: 'Network connection lost.',
stack: 'Error: Network connection lost.'
}
}
--- 2026-08-12T06:36:02.969Z error
✘ [ERROR] <- empty, as everyone above reports
"durationMs":10793 in the telemetry line: the server had been serving 200 OK for ten seconds when it died. Our three observed crashes died 99s, 34s and 10s after Ready on, so it is not a slow leak or a warm-up effect.
Frequency, counted rather than estimated
Three crashes in ten gate executions (~30%) on ubuntu-latest, over the two days since the gate landed. Two of the three were on the default branch, i.e. not attributable to any pull request's diff.
What is new: the failure is perfectly uniform, which is worth knowing
In the crash we captured in full, every one of the 121 failed tests failed with net::ERR_CONNECTION_REFUSED (484 occurrences of the string across the job log), with zero timeouts and zero ERR_ABORTED. The process is gone between navigations, not during one. That is useful for anyone building a mitigation: the failure mode after the exit is clean and classifiable, so "was this the crash or a real test failure" is decidable without heuristics.
By contrast, killing the server by hand does not reproduce that shape. Killing the workerd children alone is invisible — miniflare restarts them, which is exactly the recovery path this issue says wrangler fails to follow up on. Killing the parent alone leaves the children orphaned and still holding the port. Only killing the whole tree at once produces the clean ERR_CONNECTION_REFUSED wall, and anything staggered produces in-flight ERR_ABORTED and timeouts that the real crash does not.
The 4.113.0 workaround is narrower than it reads
The issue body's "Current workaround: pin [email protected]" cannot be applied by a project whose compatibility date is recent. Measured today against a minimal Worker with compatibility_date: "2026-08-05":
✘ [ERROR] service core:user:compat-probe: This Worker requires compatibility date
"2026-08-05", but the newest date supported by this server binary is "2026-07-28".
✘ [ERROR] The Workers runtime failed to start.
4.113.0 bundles [email protected], which tops out at compatibility date 2026-07-28. The regression starts at 4.114.0. So for any Worker declaring a date after 2026-07-28 there is no wrangler version that both runs the Worker and lacks the bug — pinning also means moving the production compatibility date backwards, which is a much larger change than a devDependency pin and not one most projects will accept.
That is worth adding to the issue body, since the workaround as written reads as generally available.
Not asking for anything
Just adding a data point and the two measurements above. For our part we have stopped trying to avoid it and instead made the gate re-run itself exactly once, but only when every failure in the attempt is this crash — so a genuine test failure is never retried. Happy to test a fix against the ~30% reproduction rate if that would help.
Confirming this is still unfixed on the current [email protected] line, with measurements from an unrelated project that chased the same empty ✘ [ERROR] for two weeks before finding this issue.
The gap is still present on wrangler 4.120.1 – 4.122.0
Counted in the installed artifacts (grep -c):
| what | where | hits |
|---|---|---|
restart path (handleWorkerdCrash / onWorkerdCrashRestart / poisonProxies) |
[email protected]/dist/src/index.js |
11 |
unsafeHandleRuntimeRestart declaration |
same file | 4 |
unsafeHandleRuntimeRestart implementation |
[email protected]/wrangler-dist/cli.js |
0 |
So the same asymmetry you described for 4.113/4.114/4.115 carries through the whole 4.12x line. We observed the failure on 4.120.1 (miniflare 5.20260804.0-alpha), 4.121.0 (5.20260804.1-alpha) and 4.122.0 (5.20260811.0-alpha) alike.
Worth noting for anyone bisecting: pinning inside that range looks like it helps, because the failure is intermittent. We pinned 4.120.1 after a version sweep appeared to isolate 4.121.0 as "the broken one" — the only actual delta between those two miniflare builds is #14993 — and the crashes came back three times afterwards on the pinned version.
Environment / trigger
Different from yours, which supports your reading that the gap is broader than any single trigger:
- monorepo running two concurrent
wrangler devsessions (an app + a separate-origin sandbox), plain HTTP, no TLS - bindings: D1 + 2× R2 + static assets,
no_bundle: true, Astro Cloudflare adapter output - Playwright
webServer, 104 tests, 8–16 parallel workers,ubuntu-latest - crashes cluster where the suite fetches a burst of
/_astro/*(Monaco workers and language modules) shortly after a cold start
Also reported once on macOS arm64 by a developer on our side, with the same signature ([WebServer] ✘ [ERROR] with no body, then ECONNREFUSED). We could not reproduce it there in 10 clean runs at 16 parallel workers today, so if it is the same path it is far rarer off Linux — matching your "never reproduced locally on macOS arm64".
On the empty error
Strong +1 for #14906. The cost of this bug is almost entirely diagnostic: we burned six rounds of CI bisecting on hypotheses that turned out to be unrelated (unread request bodies on rejected requests, --local-upstream, the wrangler version itself), because the process leaves nothing behind. Worth spelling out that WRANGLER_LOG=debug does not help either — in cli.js the stack is only logged under loggableException instanceof Error, which is exactly the branch a rehydrated SerializedError misses:
if (e.type === "error" && e.cause instanceof Error) loggableException = e.cause;
logger.error(loggableException instanceof Error ? loggableException.message : loggableException);
if (loggableException instanceof Error) logger.debug(loggableException.stack);
Happy to test a fix against our suite if that would be useful — the failure is reproducible for us on CI at a few percent per run.
Adding a data point: still present on wrangler 4.123.0, observed in CI e2e runs on GitHub-hosted ubuntu-latest.
Setup: Playwright webServer starts opennextjs-cloudflare preview (which wraps wrangler dev) serving a built Next.js app; ~90 requests-heavy browser tests over ~9 minutes per run.
- On 4.118.0 we hit the fatal exit 3 times within 24h (2026-08-14): runs died after 89/90, 5/90 and 26/90 tests respectively; every test after the death fails with
ECONNREFUSEDbecause the dev server process is gone. - After updating the lockfile to 4.123.0, the same signature recurred the next day: 52 tests green, then
✘ [ERROR](empty body) +ERROR Wrangler dev command failed. The wrangler log file ends with:
Error in ProxyController: Error inside ProxyWorker
cause: { name: 'Error', message: 'Network connection lost.' }
at ProxyController2.onProxyWorkerMessage (node_modules/wrangler/wrangler-dist/cli.js)
at async #handleLoopback (node_modules/miniflare/dist/src/index.js)
- The same commit passed a parallel push-event run and passed on re-run, and no application frames appear in any stack — intermittent and environment-sensitive, consistent with the crash→restart→stale-ProxyController path described here.
- Frequency for us: roughly 1 in 6–11 CI runs. Locally (macOS arm64) we only see a milder variant where a single in-flight request gets
read ECONNRESETand the server survives.
Since wrangler can't recover until the unsafeHandleRuntimeRestart hook is implemented, we've worked around it by supervising the serve process externally (restart on unexpected exit, capped at 2) plus Playwright retries. Posting in case the version/frequency data helps with triage.
Another reproduction of this exact fatal path — consolidating here rather than opening a duplicate. Three things look new to the thread.
1. Still present on wrangler 4.124.0
One minor past @Kewton's 4.123.0 report. Same signature, verbatim:
--- 2026-08-20T12:40:02.675Z error
✘ [ERROR] ← still empty
--- 2026-08-20T12:40:02.676Z debug
Error
at castErrorCause (wrangler-dist/cli.js:179798:20)
at ProxyController2.emitErrorEvent (wrangler-dist/cli.js:325599:20)
at ProxyController2.onProxyWorkerMessage (wrangler-dist/cli.js:325476:18)
at PROXY_CONTROLLER (wrangler-dist/cli.js:325203:24)
at process.processTicksAndRejections
at async #handleLoopbackCustomFetchService (miniflare/dist/src/index.js:111478:22)
at async #handleLoopback (miniflare/dist/src/index.js:111709:20)
Wrangler's own telemetry classifies it as fatal:
"event": "wrangler command errored",
"wranglerVersion": "4.124.0",
"sanitizedCommand": "pages dev",
"durationMs": 32155,
"isCI": true
2. A non-Playwright consumer: Lighthouse CI
Every report so far is a Playwright/browser E2E suite with multiple workers. Ours is lhci autorun against wrangler pages dev — a single browser doing three sequential navigations of one page, with a local D1 binding. So the trigger does not need many parallel workers or a request storm; three page loads is enough.
Shape: .github/actions/e2e-env starts wrangler pages dev frontend/dist --port 8788 --persist-to .wrangler/state, healthcheck passes, lhci runs 3 navigations. Runs 1 and 2 complete cleanly, the process dies during the third, and Lighthouse reports CHROME_INTERSTITIAL_ERROR because the port is now refused.
12:39:34 Healthcheck passed! server up and serving
12:40:02 ProxyController2.emitErrorEvent empty Error, process exits
12:40:26 Chrome prevented page load with an interstitial
Frequency: 5 occurrences over ~2 weeks on GitHub-hosted ubuntu-latest, on unrelated branches. Re-running the identical commit passes, which is what made it read as flake for so long.
3. Resource exhaustion is ruled out, with measurements
Worth stating because "CI runner under load" is the natural first guess and it cost us time. Captured at failure, in the same job:
| probe | value |
|---|---|
| memory | 14800 MB available of 15989 |
| load average | 1.63 |
kernel OOM kills (dmesg) |
none |
| port state | connection refused in 0.166 ms — an abort, not a hang |
| wrangler/workerd processes | none running |
So the process is gone, not wedged, and nothing external killed it.
An aside that may help others find this issue
The empty ✘ [ERROR] is genuinely all that reaches stdout — but wrangler does write the full stack above to its own log file, and names it on the way out:
🪵 Logs were written to "~/.config/.wrangler/logs/wrangler-<ts>.log"
We chased four occurrences seeing only the blank before capturing that file in CI. Anyone hitting this with a redirected stdout will have the same experience: the diagnosis is in a file the console mentions one line above the emptiness. Might be worth a line in the issue body, since several reports here describe hunting the same blank.
Happy to run a patched build or add instrumentation if that would help — this reproduces for us reliably enough to be a useful test bed.
Another data point, and it removes two variables from the repro: this reproduces with plain HTTP and a single sequential client — no --local-protocol=https, no self-signed cert, no TLS handshake aborts, and no Playwright concurrency.
Still present on [email protected], 13 minor versions after the 4.114.0 bisect above.
Environment
wrangler 4.127.0 GitHub-hosted ubuntu-latest (not a container)
Node 22.23.2 Mem: 7938 MB total
wrangler pages dev --port <p> --ip 127.0.0.1 # plain http, no --local-protocol
Static public/ + a few Pages Functions + a local D1. One Playwright worker, requests strictly sequential.
Signature — identical to yours
Empty ✘ [ERROR] immediately after a burst of ordinary static asset 304s, then every subsequent request gets ECONNREFUSED:
[wrangler:info] GET /assets/.../no-nav-shell.js 304 Not Modified (12ms)
[wrangler:info] GET / 304 Not Modified (4ms)
✘ [ERROR] <- empty, no message
If you think this is a bug then please create an issue at .../workers-sdk/issues/new/choose
page.goto: net::ERR_CONNECTION_REFUSED at http://127.0.0.1:43999/
The miniflare restart is visible in our logs
This is the part that seems to confirm your diagnosis directly — the internal log shows miniflare restarting workerd and re-establishing the websocket, and the dev server exits anyway:
[InspectorProxyWorker] handleProxyControllerIncomingMessage {"type":"reloadStart"}
[InspectorProxyWorker] reconnectRuntimeWebSocket
[InspectorProxyWorker] handleProxyControllerIncomingMessage {"type":"reloadComplete","proxyData":{"userWorkerUrl":{...,"port":"36371"},...}}
[InspectorProxyWorker] NEW RUNTIME WEBSOCKET http://127.0.0.1:37223/core:user:<worker>
[InspectorProxyWorker] SEND TO DEVTOOLS {"method":"Runtime.executionContextsCleared"}
[InspectorProxyWorker] RUNTIME WEBSOCKET OPENED
So the runtime does come back — reloadComplete, new websocket, contexts cleared — and the process still stops serving. That matches unsafeHandleRuntimeRestart not being implemented rather than workerd failing to restart.
Ruled out on our side
- Memory.
free -mcaptured at the moment of death: 6,986 MB available of 7,938. Not pressure. - A floating wrangler version. Pinned exactly to 4.127.0; unchanged.
- Connection pooling in the client. Fixed separately (
connection: close); this failure isECONNREFUSED, not a stale socket. - Concurrency. One worker, sequential requests. Your repro used 9 Playwright workers per shard across 6 shards; ours needs neither.
- TLS. Plain HTTP throughout.
Rate
5 of 10 CI runs since we added this workflow. Never once locally (Linux x64 too, ~10× the RAM) across dozens of runs of the identical suites — so it looks load- or timing-sensitive rather than environment-specific in the OS sense.
Where it lands is misleading
Worth flagging for anyone else bisecting this: because the death surfaces at whatever request comes next, the same defect was reported to us as three different bugs in three different test suites before we realised it was one dead server. Symptom location is not defect location here.
Workaround we settled on
One dev server per suite rather than one shared, plus liveness by HTTP probe rather than PID — the node process stays alive with its inspector heartbeat ticking while nothing is served, so a pid check reports healthy. Then a single retry on a fresh port (an orphaned workerd can keep the old socket, so a same-port retry fails with Address already in use and reports a bind error instead of the crash).
That converts most occurrences into a warning rather than a red build — but it is a mitigation, not a fix: we have now seen it take both attempts in one run.
Happy to capture anything specific on the next occurrence if there is a log level or env var that would help — the internal wrangler-*.log is being collected on failure already.
A second, independent trap in the documented [email protected] workaround — one that is not the compatibility_date limit already noted above, and that will hit anyone whose SSR bundle contains browser code.
I confirmed this fatal path on wrangler 4.127.0 (Astro 7 via @astrojs/cloudflare, single wrangler dev, GitHub Actions ubuntu-latest) — details and stack in #15317 rather than repeated here. It fails roughly 4 runs in 8. So I tried the pin.
The first two obstacles cleared
compatibility_date— the trap reported by @BWBama85 above. Ours is2026-05-16, comfortably older than 2026-07-28, so the pin was available to us.- Peer range —
@astrojs/[email protected]declareswrangler: ^4.125.0. It installs with--legacy-peer-depsand the production build succeeds.
And the pin does land you on the pre-regression path, which is worth recording as a check others can run:
[email protected] → nests miniflare 4.20260721.0
grep -c handleWorkerdCrash node_modules/wrangler/node_modules/miniflare/dist/src/index.js → 0
grep -c unsafeHandleRuntimeRestart same file → 0
⚠ Note for anyone running that grep: a hoisted miniflare 5.x may also be present (ours comes from @cloudflare/vite-plugin, used only at build time). require.resolve('miniflare') finds that one and it does contain the restart path — check node_modules/wrangler/node_modules/miniflare specifically, or you will conclude the pin did nothing.
The third obstacle is fatal: 4.113.0's workerd 500s every HTML page
Same commit, same build output, only the wrangler version differing:
| page | wrangler 4.113.0 | wrangler 4.127.0 |
|---|---|---|
/ |
500 | 200 |
/discover |
500 | 200 |
/sign-in |
500 | 200 |
/api/health |
200 | 200 |
useCapture errors in the dev log |
3 per request | 0 |
✘ [ERROR] TypeError: addEventListener(): useCapture must be false.
at whenReady (dist/server/chunks/page-ssr_*.mjs)
The source is @sentry/browser-utils, web-vitals onTTFB:
var whenReady = (callback) => {
if (WINDOW.document?.prerendering) whenActivated(() => whenReady(callback));
else if (WINDOW.document?.readyState !== "complete")
addEventListener("load", () => whenReady(callback), true); // ← useCapture: true
else setTimeout(callback);
};
That is a browser module that ends up in the SSR bundle. workerd 1.20260721.x rejects useCapture: true outright; the newer workerd that ships with 4.127.0 accepts it. Only /api/health survives because it never touches that code path.
So for this shape of project the pin is not a workaround: it trades an intermittent dev-server exit for a total 500. Anything with Sentry — or any other browser library using capturing listeners — in an SSR bundle will hit the same wall, and it is invisible until you request an HTML page.
One trap in verifying the pin, worth flagging separately
Our Playwright suite reported 22 passed / 18 skipped against the 4.113.0 server while every HTML page was returning 500. The specs that would have caught it skip without a database flag in local runs, so the green was vacuous. The 500 was found by curling the routes directly. If you evaluate the pin with an existing suite, request a page by hand as well.
Where that leaves us
Staying on 4.127.0 and absorbing the flake: a single CI retry gated on requiring all four of Network connection lost, castErrorCause, ProxyController and handleLoopback in the debug log — tight enough that it refuses to fire on an application crash that shares the surface symptom, since those frames cannot appear if the crash came from the user Worker. Sharing the shape in case it helps anyone else parked here; it is a splint, not a fix.
The remaining local option is to keep browser modules out of the SSR bundle and then pin — untried here, and clearly not a general answer.
Another independent reproduction, and a second bisect that lands on your boundary from a different stack. Consolidating here rather than opening a duplicate. Three things look new: an independent 4.112→4.114 bisect, kernel-level exclusion of the OOM hypothesis, and three deaths inside one run with only the first logging an error.
Environment. SvelteKit built to Cloudflare Pages output, served by wrangler pages dev as
the Playwright webServer. Plain HTTP on 127.0.0.1, no TLS, no --local-protocol=https.
One dev server, workers: 1, fullyParallel: false — strictly sequential requests.
Self-hosted Ubuntu 24.04 runner, 8 vCPU / 16 GB (not a 2-core hosted runner). Node 22.
Bindings: emulated R2 + KV, no D1, no Durable Objects, no credentials.
Independent bisect. We were not chasing wrangler — we found this issue after the fact — so our version history is an uncontaminated sample:
| date | wrangler | miniflare | our E2E suite |
|---|---|---|---|
| 2026-07-20 | 4.110.0 | 4.20260708.1 | no occurrence |
| 2026-07-27 | 4.112.0 | 4.20260714.0 | no occurrence |
| 2026-07-31 | 4.112.0 | 4.20260714.0 | no occurrence |
| 2026-08-04 | 4.114.0 | 4.20260722.0 | first occurrence 2026-08-05, next day |
| 2026-08-06 | 4.116.0 | 4.20260730.0 | recurring since |
A routine dependabot group bump crossed 4.113→4.114 and the crash appeared on the next integration run. Same boundary you bisected, different framework, different runner class.
The OOM hypothesis is excluded at the kernel level, not just by free. We sampled ~100
memory readings across a failing run: the lowest available was 11 428 MB of 15 991, and at the
three deaths it was 12 552 / 12 178 / 12 948 MB. More usefully than another free reading —
/proc/vmstat's oom_kill counter reads 0, and a journalctl sweep for OOM signatures
across all four boots since the VM was provisioned returns nothing. The kernel has never
OOM-killed anything on this machine.
Method note for anyone else ruling this out: /proc/vmstat's oom_kill is a better oracle than
dmesg — world-readable, no sudo, no kernel.dmesg_restrict change, and it counts cgroup kills
too. On our runner dmesg's ring buffer reaches back only ~9 h against a multi-day uptime
(churned out by container-networking messages), so a clean dmesg proves far less than it looks
like it does; journalctl -k --boot=<n> is the real history.
The part I think is new: three deaths in one run, accelerating, and only the first logged an
error. We supervise the dev server and restart it on any exit (capped), so a run survives a
crash and we keep logging across restarts. In one run wrangler survived 409 s, then 159 s, then
88 s. Only the first session produced Error in ProxyController: Error inside ProxyWorker
with cause: { message: 'Network connection lost.' } — the stack matching this thread
frame-for-frame through castErrorCause → emitErrorEvent → onProxyWorkerMessage →
#handleLoopbackCustomFetchService. Sessions 2 and 3 stop dead with no error entry at all,
about 6 s before the supervisor records the exit. Deaths 2 and 3 also landed mid-stream of
trivial static-asset GETs, all 200 in 3–6 ms, so there is no load correlation.
Whether the silent stops are the same defect or a second one, I cannot say. But if the shortening lifetimes are real rather than coincidence, something survives a restart in a degraded state, and that would matter for how the fix is scoped.
A side effect of supervising, worth flagging for your triage weight: most of our occurrences never fail a build. They appear only as restart lines in an otherwise green run. Frequency estimates in this thread drawn from red CI runs are therefore floors, not rates.
One source-level observation, offered as a question rather than a claim. #14848 diagnosed the
loopback server inheriting Node's default 5 s keepAliveTimeout and proposed setting both
server.keepAliveTimeout = 0 and server.headersTimeout = 0, mirroring the
headersTimeout: 0, bodyTimeout: 0 already set on the undici pools in the other direction. It
was closed as completed, but the shipped #startLoopbackServer sets only keepAliveTimeout —
in [email protected] and still in [email protected]. Node's default
headersTimeout is 60 s. Can that still close an idle pooled loopback socket, leaving a
lower-frequency version of the same race? If not, ignore this; if it can, it would be a candidate
for the trigger that this issue's analysis (correctly, I think) treats as out of scope, since
#14926 explains why a dropped connection is fatal rather than what drops it.
Happy to test a patch or a debug build. Our reproduction is intermittent but the runner is ours, so we can run the suite as many times as needed for a before/after rate, and we already collect the wrangler debug log and per-session memory on every run.