MoonshotAI / MoonshotAI/kimi-cli

kimi --continue 报错 "No previous session found",但直接 kimi 进入同一目录有历史记录 || kimi --continue reports an error "No previous session found", but directly kimi enters the same directory and has historical records.

Open
#2,222 1 comment 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?

kimi, version 1.41.0

Which open platform/subscription were you using?

kimi code

Which model were you using?

k2.6

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

问题描述

在同一工作目录下,直接执行 kimi 可以正常进入并看到历史对话记录,但执行 kimi -C(或 kimi --continue)时却提示找不到之前的 session。

复现步骤

  1. 进入工作目录:cd E:\Code\c#\hosportal_api
  2. 直接启动 Kimi:kimi → 正常进入,有历史记录
  3. 退出后再次执行:kimi -C → 报错

实际输出

PS E:\Code\c#\hosportal_api> kimi -C
Usage: kimi [OPTIONS] COMMAND [ARGS]...
Try 'kimi -h' for help.
╭─ Error ───────────────────────────────────────────────────────────╮
│ Invalid value for --continue: No previous session found for the working directory │
╰───────────────────────────────────────────────────────────────────╯

### What steps can reproduce the bug?

1. 进入工作目录:`cd E:\Code\c#\hosportal_api`
2. 直接启动 Kimi:`kimi` → 正常进入,有历史记录
3. 退出后再次执行:`kimi -C` → 报错

### What is the expected behavior?

kimi -C 应该能正确关联到当前工作目录下的历史 session,与直接执行 kimi 时的行为一致。

### Additional information

直接执行 kimi 时 session 历史是正常的,说明 session 数据本身存在
可能是 --continue 的目录匹配逻辑与默认进入时的 session 查找逻辑不一致
Windows 路径中的 # 字符或大小写差异是否会影响 session 关联?
<!--This is a translation content dividing line, the content below is generated by machine, please do not modify the content below-->
---
### What version of Kimi Code CLI is running?

kimi, version 1.41.0

### Which open platform/subscription were you using?

kimi code

### Which model were you using?

k2.6

### What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

### What issue are you seeing?

## Problem description
In the same working directory, if you execute `kimi` directly, you can enter normally and see the historical conversation records, but when you execute `kimi -C` (or `kimi --continue`), it prompts that the previous session cannot be found.

## Reproduction steps
1. Enter the working directory: `cd E:\Code\c#\hosportal_api`
2. Start Kimi directly: `kimi` → Enter normally, with history record
3. Exit and execute again: `kimi -C` → report an error

## Actual output
```powershell
PS E:\Code\c#\hosportal_api> kimi -C
Usage: kimi [OPTIONS] COMMAND [ARGS]...
Try 'kimi -h' for help.
╭─ Error ────────────────────────────────────────────────────────╮
│ Invalid value for --continue: No previous session found for the working directory │
╰───────────────────────────────────────────────────────────────╯

### What steps can reproduce the bug?

1. Enter the working directory: `cd E:\Code\c#\hosportal_api`
2. Start Kimi directly: `kimi` → Enter normally, with history record
3. Exit and execute again: `kimi -C` → report an error

### What is the expected behavior?

kimi -C should be correctly associated with the historical session in the current working directory, consistent with the behavior when executing kimi directly.

### Additional information

When executing kimi directly, the session history is normal, indicating that the session data itself exists.
It may be that the directory matching logic of --continue is inconsistent with the session search logic when entering by default.
Will # characters or case differences in Windows paths affect session affinity?

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

Reproduce the report on Windows with Kimi Code CLI 1.41.0 from E:\Code\c#\hosportal_api, comparing direct kimi startup with kimi -C. Trace how each mode matches the working directory to stored sessions, including path case and # handling; done when --continue selects the same historical session as direct startup.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.