[PR #2607] Fix TypeError in WebFetch Tool - Add Response Validation #10377

Closed
opened 2026-02-16 18:15:00 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/2607

State: closed
Merged: No


Summary

  • Fix TypeError: undefined is not an object (evaluating 'response.headers') in webfetch tool
  • Add response validation to prevent crashes when fetch fails

Changes

  • Add null check for response object before accessing headers
  • Safe access to response.headers.get() methods
  • Better error handling for failed network requests
  • Try-catch around response.arrayBuffer() call

Files Changed

  • packages/opencode/src/tool/webfetch.ts - Lines 58-76
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2607 **State:** closed **Merged:** No --- ## Summary - Fix `TypeError: undefined is not an object (evaluating 'response.headers')` in webfetch tool - Add response validation to prevent crashes when fetch fails ## Changes - Add null check for response object before accessing headers - Safe access to `response.headers.get()` methods - Better error handling for failed network requests - Try-catch around `response.arrayBuffer()` call ## Files Changed - `packages/opencode/src/tool/webfetch.ts` - Lines 58-76
yindo added the pull-request label 2026-02-16 18:15:00 -05:00
yindo closed this issue 2026-02-16 18:15:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10377