[错误] 客户端在大量提示下崩溃:路径正则表达式栈溢出(大约 900 KB 的输入),在任何网络请求之前
作者: asgorskii-dot创建于 2026年9月20日更新于 2026年9月20日
标签bug
What version of Kimi Code CLI is running? 2.0.2 ### Which open platform/subscription were you using? kimi.com account (managed:kimi-code, source=oauth) ### Which model were you using? No response ### What platform is your computer? No response ### What issue are you seeing? kimi -p with a large prompt crashes the client before any network request is made. At ~900KB of input it dies with a stack overflow inside a path-detection regex; at ~950KB it dies with a bare RangeError. Both fail in under one second. At ~900KB: error: failed to run prompt: Invalid regular expression: /^/([A-Za-z]:)?$/: Stack overflow See log: ~/.kimi-code/logs/kimi-code.log At ~950KB: RangeError: Maximum call stack size exceeded (Use kimi --trace-uncaught ... to show where the exception was thrown) Measured threshold (macOS 15 / Darwin 25.5.0, Apple Silicon, single bundled binary at ~/.kimi-code/bin/kimi): | Prompt size | Result | --- | --- | 100 KB | ok, 33s | 200 KB | ok, 12s | 400 KB | ok, 15s | 600 KB | ok, 59s | 800 KB | ok, 79s | 850 KB | ok, 68s — last working size | 900 KB | crash: Stack overflow in regex, 1s | 950 KB | crash: RangeError, 0s | Correctness was verified rather than assumed: three markers were embedded at the start, middle and end of each input, and all three had to come back. (Passing the text as a file path instead proves nothing — the agent just runs tail on the file and answers from the last lines without ever loading the content.) This is not the context window. kimi-code/k3 has a 1,048,576-token context. The same 950KB input crashes it identically and instantly, while 800KB on that same model succeeds in 32s. The server is never reached. The regex /^\/([A-Za-z]:)?$/ looks like a Windows drive-letter check; it appears to be applied to the entire prompt string rather than to a path. Secondary bug: the log it points you to is empty. The 900KB error prints See log: ~/.kimi-code/logs/kimi-code.log. That file is being written (90 lines that day) but contains zero entries for RangeError, Stack overflow or the failure itself. Users are sent to a log that has nothing in it. ### What steps can reproduce the bug? Build a UTF-8 text file of about 900KB and pass its contents as the prompt (not as a path — a path is read lazily and never enters the context): sh # ~900KB of text head -c 921600 /usr/share/dict/words > big.txt kimi -p "Summarize this in one line: $(cat big.txt)" Crashes in about one second with: error: failed to run prompt: Invalid regular expression: /^/([A-Za-z]:)?$/: Stack overflow At head -c 972800 (~950KB) the message becomes RangeError: Maximum call stack size exceeded and the process exits with code 7. Reproduced on both kimi-code/k3-256k and kimi-code/k3, so it does not depend on the model's context size. 850KB is the largest input that still works. ### What is the expected behavior? Either the
内容来源: MoonshotAI/kimi-cli