You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 23, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 23, 2026. It is now read-only.
kimi web crashes at startup on Windows when stdout is redirected: UnicodeEncodeError (gbk) in print_banner #2532
kimi web crashes immediately at startup on Chinese-locale Windows when its stdout is redirected (pipe/file) or when it is launched by a parent process that captures stdout. The crash happens while printing the startup banner: the ➜ (U+279C) character cannot be encoded with the locale codec (GBK / cp936), and the unhandled UnicodeEncodeError kills the whole process before the HTTP server binds its port.
As a result, the web server never starts, and a Web UI page already open in the browser shows repeated "实时连接出错 / WebSocket error" toasts because nothing is listening.
Environment
OS: Windows 11 (10.0.26100), Simplified Chinese locale (ANSI codepage 936 / GBK)
Kimi Code CLI: v0.28.1, native win32-x64 build (bundled with VS Code extension moonshot-ai.kimi-code, kimi_cli 1.43.0, PyInstaller / Python 3.14)
Steps to reproduce
On a Chinese-locale Windows machine, redirect stdout, e.g.:
kimi.exe web --port 58627 --no-open > web.log 2>&1
(or launch kimi web from any parent process that pipes stdout)
The process exits immediately; the port is never bound.
Actual behavior
Traceback (most recent call last):
...
in web:70
in run_web_server:437
in print_banner:118
UnicodeEncodeError: 'gbk' codec can't encode character '➜' in position 4:
illegal multibyte sequence
[PYI-xxxxx:ERROR] Failed to execute script '__main__' due to unhandled exception!
Expected behavior
Banner printing should never crash the server. Please make print_banner encoding-safe (e.g. write with errors="replace", force UTF-8, or drop non-encodable characters) so kimi web starts regardless of stdout encoding / console availability.
What does NOT help
chcp 65001, PYTHONUTF8=1, and PYTHONIOENCODING=utf-8 all fail to prevent the crash when stdout is redirected (verified on v0.28.1).
Workaround
Run kimi web attached to a real console window (cmd / PowerShell / Windows Terminal) and keep that window open — console I/O uses UTF-8 (PEP 528), so the banner prints fine and the server starts normally.
Activity