BIT-31305 (Error Loop): the worker crashed once on node09 CT 264 with AssertionError [ERR_ASSERTION]: false == true at Parser.finish in Node's bundled undici — this is nodejs/undici#5360, an uncatchable assertion thrown from the socket end handler when the HTTP/1 parser is paused for backpressure while the remote socket ends.
pm2 already auto-restarted the worker within the same second (confirmed live: photoreport-worker-error-1.log on CT 264 ends exactly on this assertion, followed by a clean restart ~1h20m before investigation).
watchProcess() in apps/api/src/lib/reporter.ts was treating this as fatal like any other uncaught exception, killing the whole process (and any other in-flight work) over one already-closed connection.
This change recognizes the narrow ERR_ASSERTION + undici + Parser.finish/onHttpSocketEnd signature and reports it as a warning without exiting; every other uncaught exception still fails fast as before.
Test plan
pnpm vitest run test/reporter.test.ts — 5/5 pass (new test simulates the exact production stack trace, asserts process.exit is not called and the event is reported at warning level)
Confirmed pre-existing (unrelated) typecheck errors in apps/api are present on main too (stale @photoreport/metadata build output), not introduced by this change
## Summary
- BIT-31305 (Error Loop): the worker crashed once on node09 CT 264 with `AssertionError [ERR_ASSERTION]: false == true` at `Parser.finish` in Node's bundled undici — this is [nodejs/undici#5360](https://github.com/nodejs/undici/issues/5360), an uncatchable assertion thrown from the socket end handler when the HTTP/1 parser is paused for backpressure while the remote socket ends.
- `pm2` already auto-restarted the worker within the same second (confirmed live: `photoreport-worker-error-1.log` on CT 264 ends exactly on this assertion, followed by a clean restart ~1h20m before investigation).
- `watchProcess()` in `apps/api/src/lib/reporter.ts` was treating this as fatal like any other uncaught exception, killing the whole process (and any other in-flight work) over one already-closed connection.
- This change recognizes the narrow `ERR_ASSERTION` + `undici` + `Parser.finish`/`onHttpSocketEnd` signature and reports it as a warning without exiting; every other uncaught exception still fails fast as before.
## Test plan
- [x] `pnpm vitest run test/reporter.test.ts` — 5/5 pass (new test simulates the exact production stack trace, asserts `process.exit` is not called and the event is reported at `warning` level)
- [x] Confirmed pre-existing (unrelated) typecheck errors in `apps/api` are present on `main` too (stale `@photoreport/metadata` build output), not introduced by this change
A single-occurrence critical alert (BIT-31305) traced to node09 CT 264: the
worker crashed with AssertionError [ERR_ASSERTION]: false == true at
Parser.finish in Node's bundled undici. That is nodejs/undici#5360 -- the
HTTP/1 parser asserts !this.paused when the remote socket ends while the
parser is paused for backpressure, and throws uncatchably from the socket
end handler. pm2 already restarted the worker within the same second, but
watchProcess() was also killing the whole process (and losing any other
in-flight work) for this one already-closed connection.
Recognize the narrow ERR_ASSERTION + undici + Parser.finish signature in
watchProcess() and report it as a warning without exiting; every other
uncaught exception still fails fast as before.
Paperclip-Issue: BIT-31305
Paperclip-Run: 02f17eaf-2939-43e0-93b2-f6d047452558
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
AssertionError [ERR_ASSERTION]: false == trueatParser.finishin Node's bundled undici — this is nodejs/undici#5360, an uncatchable assertion thrown from the socket end handler when the HTTP/1 parser is paused for backpressure while the remote socket ends.pm2already auto-restarted the worker within the same second (confirmed live:photoreport-worker-error-1.logon CT 264 ends exactly on this assertion, followed by a clean restart ~1h20m before investigation).watchProcess()inapps/api/src/lib/reporter.tswas treating this as fatal like any other uncaught exception, killing the whole process (and any other in-flight work) over one already-closed connection.ERR_ASSERTION+undici+Parser.finish/onHttpSocketEndsignature and reports it as a warning without exiting; every other uncaught exception still fails fast as before.Test plan
pnpm vitest run test/reporter.test.ts— 5/5 pass (new test simulates the exact production stack trace, assertsprocess.exitis not called and the event is reported atwarninglevel)apps/apiare present onmaintoo (stale@photoreport/metadatabuild output), not introduced by this changeauto-approve: CI success (gitea_auto_approve_open_prs_once.py)
auto-approve: CI success (gitea_auto_approve_open_prs_once.py)
auto-approve: CI success (gitea_auto_approve_open_prs_once.py)