Skip to content

fix(host): log the network error behind a failed model request - #705

Merged
iamnbutler merged 3 commits into
mainfrom
model-errors
Oct 27, 2026
Merged

iamnbutler merged 3 commits into
mainfrom
model-errors

Conversation

@iamnbutler

Copy link
Copy Markdown
Contributor

Idan's runs keep failing with "Run failed: Connection error." on both Anthropic and OpenAI, while curl and Bun from his shell reach both fine. The SDKs wrap any fetch failure as "Connection error." and pi-ai keeps only that message, so the log never says what actually broke.

  • The channel worker wraps fetch and logs fetch.failed with the URL (no query) and the full error before the SDK sees it.
  • failure() now keeps an error's code (Bun sets ECONNRESET, ConnectionRefused and similar), alongside the message, stack and cause it already kept.

Checked: the Anthropic SDK pointed at a dead port still reports "Connection error.", and the wrapper logs ConnectionRefused with Bun's message. A real Opus run through a worker from this branch completed normally.

Built in Ace

No. Claude Code in a terminal wrote this while debugging the failures with Nate and Idan during a dogfooding session; that session already had the logs and context. Tracked under #5.

Why: apps/host/src/worker.ts | the model SDKs and pi-ai keep only "Connection error.", so the worker's fetch must log the real error before it is wrapped
@iamnbutler
iamnbutler merged commit 534b4a2 into main Oct 27, 2026
1 check passed
@iamnbutler
iamnbutler deleted the model-errors branch October 27, 2026 19:29
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