[PR #7031] fix(app) TypeError: Failed to execute 'set' on 'Headers': String contains non IS0-8859-1 code point. #12212

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

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

State: closed
Merged: No


Why it crashed

mergeConfigs() calls mergeHeaders(), which ends up doing Headers.set(...). In Tauri/WebView, Headers.set() throws if the header key/value contains characters outside ISO‑8859‑1. We were putting a raw filesystem path into x-opencode-directory, and paths can contain Unicode.

Fix (implemented)

SDK: URL-encode the directory header as opencode-uri: + encodeURIComponent(directory) (done for both v1 + v2 clients).
Server: If the incoming directory value starts with opencode-uri:, decode it before using it.

企业微信截图_17676675582211
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7031 **State:** closed **Merged:** No --- ## Why it crashed mergeConfigs() calls mergeHeaders(), which ends up doing Headers.set(...). In Tauri/WebView, Headers.set() throws if the header key/value contains characters outside ISO‑8859‑1. We were putting a raw filesystem path into x-opencode-directory, and paths can contain Unicode. ## Fix (implemented) SDK: URL-encode the directory header as opencode-uri: + encodeURIComponent(directory) (done for both v1 + v2 clients). Server: If the incoming directory value starts with opencode-uri:, decode it before using it. <img width="953" height="516" alt="企业微信截图_17676675582211" src="https://github.com/user-attachments/assets/5ef5dfba-6203-4858-b0d8-869800f434c3" />
yindo added the pull-request label 2026-02-16 18:17:08 -05:00
yindo closed this issue 2026-02-16 18:17:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12212