Conversation
…ONNRESET Agent-Logs-Url: https://github.com/obrienma/EventHorizon/sessions/bf84ff59-01a9-486b-84dd-69d463f1cee9 Co-authored-by: obrienma <3357771+obrienma@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix ECONNRESET error in worker
fix(worker): declare RabbitMQ topology before consuming to prevent ECONNRESET
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Worker crashed with
ECONNRESETon startup because it calledch.consume()against a queue that didn't exist yet — topology was only declared inconnectQueue()(server path), so any startup order where the worker leads caused RabbitMQ to close the channel withNOT_FOUND.Changes
queue.ts— extracted topology setup into exporteddeclareTopology(ch: amqp.Channel).connectQueue()delegates to it; no behavioural change for the server path.worker.ts— imports and callsdeclareTopology(ch)after channel creation, beforech.prefetch()/ch.consume(). Worker is now startup-order-independent.worker.test.ts— addsassertExchange,assertQueue,bindQueuestubs tomockChto cover the new topology call.vitest.config.ts— adds required env vars so config-dependent test suites (worker, routes, metrics) load correctly; fixes a pre-existing gap that caused those suites to fail before any test ran.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fastdl.mongodb.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./postinstall.js(dns block)/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --experimental-import-meta-resolve --require /home/REDACTED/work/EventHorizon/EventHorizon/node_modules/vitest/suppress-warnings.cjs --conditions node --conditions development /home/REDACTED/work/EventHorizon/EventHorizon/node_modules/vitest/dist/workers/forks.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
[worker] > event-horizon@1.0.0 worker
[worker] > tsx src/processing/worker.ts
[worker]
[server]
[server] > event-horizon@1.0.0 dev
[server] > tsx src/server.ts
[server]
[worker] [db] connected to "eventhorizon"
[worker] [repository] indexes ensured
[worker] node:internal/modules/run_main:107
[worker] triggerUncaughtException(
[worker] ^
[worker]
[worker] Error: read ECONNRESET
[worker] at TCP.onStreamRead (node:internal/stream_base_commons:216:20) {
[worker] errno: -104,
[worker] code: 'ECONNRESET',
[worker] syscall: 'read'
[worker] }
[worker]
[worker] Node.js v24.11.1
[worker] npm run worker exited with code 1
[server] [ws] server registered at /ws
[server] [db] connected to "eventhorizon"
[server] [repository] indexes ensured
[server] node:internal/modules/run_main:107
[server] triggerUncaughtException(
[server] ^
The user has attached the following file paths as relevant context:
- .github/copilot-instructions.md
- CLAUDE.md
[Chronological Review: The conversation began with the user executing commands to run a worker and server for the Event Horizon project. The worker encountered an error (ECONNRESET) during execution, which led to the user attempting to cancel a previous command and then delegate a task to a cloud agent. The user repeated the command to run the worker and server, encountering the same error again.][Intent Mapping: The user explicitly requested to "Delegate to cloud agent" after encountering an error with the worker process. The intent appears to be to offload some tasks or issues to a cloud agent for resolution.]
[Technical Inventory: The conversation involved the following technologies:
[Code Archaeology: The user was working with the following files:
src/processing/worker.ts: This file is likely responsible for processing tasks in the worker.src/server.ts: This file is likely responsible for setting up the server for the application.CLAUDE.md, which may contain documentation or notes related to the project.][Progress Assessment: The user has attempted to run the worker and server multiple times but has encountered a consistent error (ECONNRESET). The worker process exited with code 1, indicating a failure.]
[Context Validation: The user is trying to resolve issues related to the worker and server processes in the Event Horizon project, specifically dealing with connection errors.]
[Recent Commands Analysis:
npm run workerto start the worker process.npm run devto start the server process./wsbut also triggered an uncaught exception.]1. Conversation Overview: - Primary Objectives: The user aimed to run the Event Horizon project, specifically the worker and server processes, and to delegate tasks to a cloud agent due to encountered errors. - Session Context: The conversation involved executing commands to start the worker and server, encountering connection errors, and attempting to delegate tasks. - User Intent Evolution: The user shifted from trying to resolve the worker error to seeking assistance from a cloud agent.- Technical Foundation:
- Node.js: Version 24.11.1, used as the runtime environment for the application.
- TypeScript: Utilized for running TypeScript files with the
- Event Horizon: The project name, indicating an event-driven architecture focus.
- Codebase Status:
- File Name:
- Purpose: Responsible for processing tasks in the worker.
- Current State: Encountered an ECONNRESET error during execution.
- File Name:
- Purpose: Sets up the server for the application.
- Current State: Registered successfully at
- Problem Resolution:
- Issues Encountered: The worker process faced a "read ECONNRESET" error, causing it to exit unexpectedly.
- Solutions Implemented: The user attempted to restart the worker and server processes and considered delegating tasks to a cloud agent.
- Debugging Context: The user is actively troubleshooting connection issues with the worker process.
- Progress Tracking:
- Completed Tasks: The user successfully executed commands to start the worker and server, but both encountered errors.
- Partially Complete Work: The worker process is not functioning due to the ECONNRESET error.
- Validated Outcomes: The server registered at
- Active Work State:
- Current Focus: The user was attempting to run the work...
tsxcommand.src/processing/worker.tssrc/server.ts/wsbut also faced an uncaught exception./ws, but further functionality is hindered by the worker's failure.Created from VS Code.