anomalyco / anomalyco/opencode
webfetch collapses all errors to one message and hard-fails on >5MB responses
@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:
-
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>(theEffect.mapErrorat the end ofexecutediscards the error channel, unlikeskill.tswhich passes the error through). The model can't distinguish retryable from non-retryable and can't adapt. -
Oversized responses hard-fail instead of truncating.
MAX_RESPONSE_BYTES(5MB) is enforced viaEffect.failincollectBoundedResponseBody, 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.