WebUI fails with non-ASCII directory names (TypeError: String contains non ISO-8859-1 code point) #4221

Closed
opened 2026-02-16 17:43:04 -05:00 by yindo · 1 comment
Owner

Originally created by @sora-grayscale on GitHub (Jan 5, 2026).

Originally assigned to: @adamdotdevin on GitHub.

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

  1. Create a directory with non-ASCII characters (e.g., 卒業旅行 in Japanese)
  2. Initialize a git repository in that directory
  3. Start OpenCode in that directory: opencode
  4. Open the WebUI in browser (http://127.0.0.1:37501)
  5. 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.).

Originally created by @sora-grayscale on GitHub (Jan 5, 2026). Originally assigned to: @adamdotdevin on GitHub. ## 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 1. Create a directory with non-ASCII characters (e.g., `卒業旅行` in Japanese) 2. Initialize a git repository in that directory 3. Start OpenCode in that directory: `opencode` 4. Open the WebUI in browser (http://127.0.0.1:37501) 5. 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.).
yindo added the web label 2026-02-16 17:43:04 -05:00
yindo closed this issue 2026-02-16 17:43:04 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 5, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #6906: WebUI fails with non-ASCII directory names (Chinese characters) - Same 'String contains non ISO-8859-1 code point' error with non-ASCII paths in HTTP headers

Feel free to ignore if this doesn't address your specific case.

@github-actions[bot] commented on GitHub (Jan 5, 2026): This issue might be a duplicate of existing issues. Please check: - #6906: WebUI fails with non-ASCII directory names (Chinese characters) - Same 'String contains non ISO-8859-1 code point' error with non-ASCII paths in HTTP headers Feel free to ignore if this doesn't address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4221