Skip to content

Non-ASCII (Korean/CJK) characters in directory path cause "Header has invalid value" error (regression in v1.1.56) #13167

Closed

Description

@SOPA5

Bug Description

opencode crashes on startup when the working directory path contains non-ASCII characters (Korean, CJK, etc.).

This is a regression introduced between v1.1.53 and v1.1.56.

Error

TypeError: Header 'x-opencode-directory' has invalid value
    at mergeHeaders (../sdk/js/src/gen/client/utils.gen.ts:184:23)
    at mergeConfigs (../sdk/js/src/gen/client/utils.gen.ts:161:20)
    at createClient (../sdk/js/src/gen/client/client.gen.ts:21:17)
    at createOpencodeClient (../sdk/js/src/gen/client/client.gen.ts:135:10)

Root Cause

The x-opencode-directory HTTP header is set with the raw directory path string. The Web Headers.set() API only accepts Latin1 (ISO-8859-1) characters, so any path containing Korean, CJK, or other non-Latin1 characters causes a TypeError.

Reproduction

  1. Create a directory with non-ASCII characters in the path:
    mkdir C:\temp\test\한글경로\coding
    
  2. Run opencode v1.1.56 in that directory:
    cd C:\temp\test\한글경로\coding
    opencode
    
  3. Observe the TypeError crash.

Version Testing Results

Version Result
v1.1.36 ✅ Works
v1.1.49 ✅ Works
v1.1.50 ✅ Works
v1.1.53 ✅ Works
v1.1.56 ❌ Fails

Environment

  • OS: Windows 10 (Build 26200.7840)
  • opencode: v1.1.56 (installed via scoop)
  • Node: v24.13.0
  • Bun: 1.3.9

Suggested Fix

URL-encode or Base64-encode the x-opencode-directory header value before passing it to Headers.set(). For example:

// Before (broken for non-ASCII)
headers.set('x-opencode-directory', directory);

// After (safe for all characters)
headers.set('x-opencode-directory', encodeURIComponent(directory));

On the receiving end, decode with decodeURIComponent().

Workaround

Downgrade to v1.1.53:

scoop reset [email protected]

Activity

  1. github-actions commented on Feb 11, 2026

    @github-actions
    Contributor

    This issue appears to be a duplicate or closely related to existing reports about the same regression. Please check these issues:

    All of these appear to be related to the same root cause you've identified: the x-opencode-directory HTTP header not properly encoding non-ASCII characters in v1.1.56.

  2. ars-ppi commented on Feb 12, 2026

    @ars-ppi
    Image

    Tested the below versions:

    Image

    Results

    Version Status
    v1.1.50 OK
    v1.1.51 OK
    v1.1.52 OK
    v1.1.53 OK
    v1.1.54 CRASH
    v1.1.55 CRASH
    v1.1.56 CRASH
    v1.1.57 OK
    v1.1.58 OK
    v1.1.59 OK
    v1.1.60 OK

    @rekram1-node I think this and related issues can be closed.

  3. github-actions commented on Apr 14, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions