MoonshotAI / MoonshotAI/kimi-cli

Git仓库中带有中文UTF8文件名时,使用@搜索文件,输入第三个字符后会报错

Open
#1,866 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
11.4k
Forks
1.3k
Avg merge
9h 47m
Merged PRs (30d)
2

Description

What version of Kimi Code CLI is running?

1.33

Which open platform/subscription were you using?

windows, kimi-for-coding, kimi-cli

Which model were you using?

No response

What platform is your computer?

No response

What issue are you seeing?
Image

Exception in thread Thread-8 (_readerthread):
Traceback (most recent call last):
File "C:\Users\guoshuting01\AppData\Roaming\uv\python\cpython-3.12.11-windows-x86_64-none\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
File "C:\Users\guoshuting01\AppData\Roaming\uv\python\cpython-3.12.11-windows-x86_64-none\Lib\threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\guoshuting01\AppData\Roaming\uv\python\cpython-3.12.11-windows-x86_64-none\Lib\subprocess.py", line 1599, in _readerthread
buffer.append(fh.read())
^^^^^^^^^
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 16: illegal multibyte sequence
Exception in thread Thread-10 (_readerthread):
Traceback (most recent call last):
File "C:\Users\guoshuting01\AppData\Roaming\uv\python\cpython-3.12.11-windows-x86_64-none\Lib\threading.py", line 1075, in _bootstrap_inner
self.run()
File "C:\Users\guoshuting01\AppData\Roaming\uv\python\cpython-3.12.11-windows-x86_64-none\Lib\threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\guoshuting01\AppData\Roaming\uv\python\cpython-3.12.11-windows-x86_64-none\Lib\subprocess.py", line 1599, in _readerthread
buffer.append(fh.read())
^^^^^^^^^
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 16: illegal multibyte sequence

Unhandled exception in event loop:
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\prompt_toolkit\buffer.py", line 1923, in new_coroutine
await coroutine(*a, **kw)
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\prompt_toolkit\buffer.py", line 1740, in async_completer
async for completion in async_generator:
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\prompt_toolkit\completion\base.py", line 186, in get_completions_async
for item in self.get_completions(document, complete_event):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\prompt_toolkit\completion\deduplicate.py", line 30, in get_completions
for completion in self.completer.get_completions(document, complete_event):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\prompt_toolkit\completion\base.py", line 367, in get_completions
yield from completer.get_completions(document, complete_event)
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\kimi_cli\ui\shell\prompt.py", line 775, in get_completions
candidates = list(self._fuzzy.get_completions(mention_doc, complete_event))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\prompt_toolkit\completion\fuzzy_completer.py", line 91, in _get_fuzzy_completions
inner_completions = list(
^^^^^
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\prompt_toolkit\completion\word_completer.py", line 62, in get_completions
words = words()
^^^^^^^
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\kimi_cli\ui\shell\prompt.py", line 664, in _get_paths
return self._get_deep_paths()
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\kimi_cli\ui\shell\prompt.py", line 722, in _get_deep_paths
paths = list_files_git(self._root, scope)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\kimi_cli\utils\file_filter.py", line 247, in list_files_git
paths = _parse_ls_files_output(result.stdout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\guoshuting01\AppData\Roaming\uv\tools\kimi-cli\Lib\site-packages\kimi_cli\utils\file_filter.py", line 158, in _parse_ls_files_output
for entry in stdout.split("\0"):
^^^^^^^^^^^^

Exception 'NoneType' object has no attribute 'split'
Press ENTER to continue...

What steps can reproduce the bug?

在有中文文件名的目录中创建git仓库,然后使用@搜索文件,输入第三个字母后报错

Image
What is the expected behavior?

No response

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in kimi_cli/ui/shell/prompt.py at _get_deep_paths and in kimi_cli/utils/file_filter.py at list_files_git and _parse_ls_files_output. Reproduce on Windows with a Git repository containing a Chinese UTF-8 filename, then trigger @ file search by typing three characters. Done means file completions work without the UnicodeDecodeError or the NoneType split exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
cli, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.