Skip to content

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

@sora-grayscale

Description

@sora-grayscale

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.).

Metadata

Metadata

Assignees

Labels

webRelates to opencode on web / desktop

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions