WebSocket connection fails with non-ASCII characters in workspace path
Resolved 💬 4 comments Opened Apr 1, 2026 by 7vf7gcpwsy-create Closed Apr 30, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
Bug
Codex CLI fails to establish WebSocket connections when the workspace path contains non-ASCII characters (e.g., CJK characters). The path is placed into the x-codex-turn-metadata HTTP header, which does not support non-ASCII bytes.
Reproduction
# Working directory contains Chinese characters: /Users/me/大山/shipping-analysis
codex exec "echo hello"
Error
ERROR codex_api::endpoint::responses_websocket: failed to connect to websocket:
UTF-8 encoding error: failed to convert header to a str for header name
'x-codex-turn-metadata' with value: "...com~apple~CloudDocs/\xe5\xa4\xa7\xe5\xb1\xb1/shipping-analysis..."
\xe5\xa4\xa7\xe5\xb1\xb1 is valid UTF-8 for 大山, but HTTP headers are restricted to visible ASCII (RFC 7230 §3.2.6). The connection retries 5 times and eventually falls back, but this adds ~10 seconds of delay to every single invocation.
Expected behavior
Non-ASCII path components in x-codex-turn-metadata should be percent-encoded or base64-encoded before being placed into the HTTP header.
Environment
- Codex CLI: v0.118.0
- OS: macOS 15.4 (Darwin 25.4.0)
- Auth: ChatGPT (Pro plan)
- Path: iCloud Drive path containing CJK characters
Workaround attempted
Creating an ASCII-only symlink does not help — Codex resolves symlinks to the real path internally.
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I can reproduce the same failure on a newer Codex CLI release with a Chinese workspace path on macOS.
Environment:
codex-cli 0.123.0LANG=zh_CN.UTF-8,LC_CTYPE=C.UTF-8,LC_ALL=C.UTF-8/Users/.../Documents/Projects/doc/zh/<Chinese workspace name>has_changes: trueObserved error:
The failing header value contains the workspace path encoded as escaped UTF-8 byte sequences for the Chinese path component, e.g.
\\xe6.... This appears to still affect the CLI in0.123.0, not only0.118.0.I am redacting the exact local project name, but the trigger is a non-ASCII/CJK workspace path being included in
x-codex-turn-metadataduring stream fallback/reconnect.Confirming this is still reproducible on codex-cli v0.125.0 (latest stable, 2026-04-30).
Environment
/Users/<user>/Library/CloudStorage/OneDrive-ポラリスソリューションズ株式会社/Project/Claude-AlmightyBehavior
failed to convert header to a str for header name 'x-codex-turn-metadata'
with value: "...workspaces":{"/Users/.../OneDrive-\xe3\x83\x9b\xe3\x82\x9a..."
User-side workarounds tested (none effective)
cdvia the symlink: still fails — Codex resolves thephysical path internally (likely via
git rev-parse --show-toplevel)PWD/OLDPWDenv vars to ASCII paths: ignoredThe path embedded in the header is the realpath, not the logical cwd, so users
on cloud-sync directories with localized folder names (OneDrive's localized
tenant path, iCloud Drive CJK paths, etc.) cannot avoid this without abandoning
their sync setup.
Suggestion: percent-encode or base64-encode the JSON value before placing it
into the
x-codex-turn-metadataHTTP header (RFC 7230 §3.2.6).This is fixed in https://github.com/openai/codex/pull/19620. The fix will be included in the next release.