MoonshotAI / MoonshotAI/kimi-cli
Ctrl+V crashes with TypeError when clipboard contains non-text data (e.g. screenshot)
Nobody has claimed this yet.
- 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?
kimi, version 1.30.0
Which open platform/subscription were you using?
N/A (reproducible on any platform)
Which model were you using?
No response
What platform is your computer?
Darwin 25.2.0 arm64 arm
What issue are you seeing?
Pressing Ctrl+V crashes with a TypeError when the system clipboard holds non-text data (e.g. a screenshot). The
traceback points to prompt_toolkit internals doing "\n" in text where text is None because pyperclip.paste()
returned None.
Two distinct trigger paths lead to this crash:
- Screenshot in clipboard + model doesn't support image input: _try_paste_media() detects the image, prints a
warning, but returns False. The Ctrl+V handler then falls through to the text paste path, where pyperclip.paste()
returns None → TypeError. - Any non-text clipboard content (covered by #1750): pyperclip.paste() returns None regardless of whether
media detection ran, and prompt_toolkit's PyperclipClipboard.get_data() crashes on it.
TypeError: argument of type 'NoneType' is not iterable
What steps can reproduce the bug?
- Start kimi-cli with a model that does not support image input
- Take a screenshot (so the clipboard holds an image)
- Press Ctrl+V in the prompt
What is the expected behavior?
- If the model doesn't support images: show the "Image input is not supported" warning and do nothing else (no crash)
- If the clipboard simply has no text: silently ignore the paste (no crash)
Additional information
Related to #1750.
A fix is available at exqqstar/kimi-cli@e2230992
(branch:
fix/clipboard-crash-non-text-paste).
Will open a PR once this issue is confirmed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Ctrl+V handler and _try_paste_media(), then inspect prompt_toolkit's PyperclipClipboard.get_data() and the pyperclip.paste() result. Reproduce with an image and other non-text clipboard contents; done means the unsupported-image warning remains without a crash and empty text paste is ignored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100