uncaught exception; source = Uncaught (in promise); stack = Error: Network connection lost.

All of a sudden I've started seeing errors whenever I try and run a worker locally. This include a simple "hello-world" worker. When I run it, no requests reach the worker. I added --log-level debug and I see a constant stream of exceptions that look like this: exception = kj/async-io-unix.c++:1538: disconnected: connect(): Connection refused As of a couple days ago this all worked fine, so I have no idea what changed. Anyone seen anything like this/have any ideas?
1 Reply
fortytwo
fortytwoOP3mo ago
I tried something fresh via: npm create cloudflare@latest -- worker-test cd worker-test npx wrangler dev --log-level debug And that repros this for me. wrangler.jsonc is:
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "worker-test",
"main": "src/index.ts",
"compatibility_date": "2025-09-09",
"observability": {
"enabled": true
}
}
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "worker-test",
"main": "src/index.ts",
"compatibility_date": "2025-09-09",
"observability": {
"enabled": true
}
}
I tried the same thing on another computer of mine and that seems to work, so it seems like some weird state on this machine? I tried wiping the .wrangler directory but no luck there. This appears to be the root cause in the stack:
workerd/io/worker.c++:2103: info: uncaught exception; source = Uncaught (in promise); stack =
Error: Network connection lost.
workerd/io/io-context.c++:368: info: uncaught exception; exception =
workerd/jsg/_virtual_includes/iterator/workerd/jsg/value.h:1479: disconnected: jsg.Error: Network
workerd/io/worker.c++:2103: info: uncaught exception; source = Uncaught (in promise); stack =
Error: Network connection lost.
workerd/io/io-context.c++:368: info: uncaught exception; exception =
workerd/jsg/_virtual_includes/iterator/workerd/jsg/value.h:1479: disconnected: jsg.Error: Network
I ended up fixing this by passing --ip 127.0.0.1 when running npx wrangler dev. Definitely would've been nice to get an error message that made this a bit clearer I have an ipv6 interface, so it may be that it was trying to bind there by default and that's what was causing this issue

Did you find this page helpful?