anomalyco / anomalyco/opencode

webfetch collapses all errors to one message and hard-fails on >5MB responses

Open
#45,929 1 comment 0 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Aug 28, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Describe the bug

Two related error-handling gaps in webfetch:

  1. Every failure collapses to one message. Timeout, >5MB response, unsupported content-type, and HTTP 403/404 all reach the model as the identical Unable to fetch <url> (the Effect.mapError at the end of execute discards the error channel, unlike skill.ts which passes the error through). The model can't distinguish retryable from non-retryable and can't adapt.

  2. Oversized responses hard-fail instead of truncating. MAX_RESPONSE_BYTES (5MB) is enforced via Effect.fail in collectBoundedResponseBody, so a page over 5MB (common with inlined JSON SPA data) returns nothing at all — despite the tool description promising "Large text results may be replaced with a preview".

Affected code

packages/core/src/tool/webfetch.ts — final Effect.mapError; collectBody/http-body.ts size limit.

Suggested fix

Preserve the specific error message, and truncate/preview oversized responses instead of hard-failing.

Environment
  • opencode version: latest dev

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.