MoonshotAI / MoonshotAI/kimi-code
[Bug] session_index.jsonl loses newline between entries, causing session.not_found on resume
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Bug Report
Summary
session_index.jsonl can end up with two JSON objects concatenated on the same line (missing newline separator), which causes kimi --session <id> to fail with [session.not_found] even when the session directory exists and is intact.
Environment
- kimi-code version: v0.27.0
- Platform: Windows x64
- Node version: v24.15.0
Steps to Reproduce
- Create multiple sessions in the same working directory over several kimi-code launches.
- At some point, the index write loses the newline separator between two entries.
- Attempt to resume the earlier session by ID:
kimi --session <id>. - Error:
Failed to resume session <id>: [session.not_found]
Root Cause
session_index.jsonl had two JSON objects on the same line without a newline separator.
When the CLI reads the index line-by-line, the first line fails to parse, so the session entry becomes unreadable.
Workaround
Manually split the concatenated entry onto its own line in ~/.kimi-code/session_index.jsonl.
Notes
- The session directory is fully intact: state.json, wire.jsonl (~878KB), agents/main/ all present and valid.
- This appears to be a bug in the index append/write logic where the newline separator is occasionally lost.
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 by locating the session_index.jsonl append/write logic and the CLI code that reads the index line by line. Reproduce multiple session launches, then verify that each JSON object has its own newline and that kimi --session resumes an intact session without session.not_found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100