-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Description
Bug Description
The OpenCode WebUI crashes with a TypeError: Failed to execute 'set' on 'Headers': String contains non ISO-8859-1 code point error when the working directory name contains non-ASCII characters (e.g., Japanese characters).
Steps to Reproduce
- Create a directory with non-ASCII characters (e.g.,
卒業旅行in Japanese) - Initialize a git repository in that directory
- Start OpenCode in that directory:
opencode - Open the WebUI in browser (http://127.0.0.1:37501)
- WebUI fails to load with the error below
Error Message
TypeError: Failed to execute 'set' on 'Headers': String contains non ISO-8859-1 code point.
TypeError: String contains non ISO-8859-1 code point.
at lM (http://127.0.0.1:37501/assets/index-i9Uo1TP8.js:1705:4971)
at Of (http://127.0.0.1:37501/assets/index-i9Uo1TP8.js:1705:4646)
at uM (http://127.0.0.1:37501/assets/index-i9Uo1TP8.js:1705:5716)
at ro (http://127.0.0.1:37501/assets/index-i9Uo1TP8.js:1705:29352)
at Object.init (http://127.0.0.1:37501/assets/index-i9Uo1TP8.js:1728:25092)
at provider (http://127.0.0.1:37501/assets/index-i9Uo1TP8.js:532:18539)
at http://127.0.0.1:37501/assets/index-i9Uo1TP8.js:2:9110
at Ge (http://127.0.0.1:37501/assets/index-i9Uo1TP8.js:2:3351)
at l (http://127.0.0.1:37501/assets/index-i9Uo1TP8.js:2:9103)
at get children (http://127.0.0.1:37501/assets/index-i9Uo1TP8.js:1728:255886)
Environment
- OpenCode Version: 1.1.2
- OS: Fedora Linux 43 (6.17.12-300.fc43.x86_64)
- Browser: Chrome/Firefox (occurs in multiple browsers)
- Directory Name:
卒業旅行(Japanese: "graduation trip") - Working Directory Path:
/home/fedora/Desktop/dev/guraduation-trip
Expected Behavior
The WebUI should load successfully regardless of directory name encoding.
Actual Behavior
The WebUI fails to load with an HTTP header encoding error when the directory name contains non-ASCII characters.
Workaround
The CLI mode works fine. Only the WebUI is affected. Renaming the directory to ASCII-only characters (e.g., graduation-trip) resolves the issue.
Root Cause (Hypothesis)
The WebUI appears to be setting directory names or file paths in HTTP headers without proper UTF-8 encoding. HTTP headers in the Fetch API require ISO-8859-1 encoding, and UTF-8 strings need to be properly encoded before being set as header values.
Suggested Fix
When setting HTTP headers with potentially non-ASCII values (like file paths, directory names, etc.), properly encode them using:
- Base64 encoding, or
- Percent encoding (encodeURIComponent), or
- Ensure proper UTF-8 to ISO-8859-1 conversion
Additional Notes
This affects international users who use non-ASCII characters in their directory names, which is common in many languages (Japanese, Chinese, Korean, Arabic, etc.).