Skip to content

[BUG] Resume session after killing - "No conversation found with session ID" #12730

Description

@iurii-iufimov-forgood

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Probably, this is similar to
#7004

My project has a Rust backend and spawns claude-code for user operations.

For the test I've removed all command/shell wrappers and started spawning claude directly from which output:
/Users/USER_NAME/.nvm/versions/node/v22.18.0/bin/claude

The issue:
if I stop claude session, and then try to continue it with --resume flag, I've got an error in STDERR:

No conversation found with session ID: 33a81b24-1b27-4a23-951a-34f1bdaff28f
  • Process exits cleanly with exit code 143 (SIGTERM)
  • Session files are created in ~/.claude/projects//
  • Session ID file exists (e.g., b310b758-990b-4ecc-8e98-d7cb0b64198a.jsonl)

But session cannot be resumed.

What Should Happen?

Session should be resumable.
Or, at least, some instruction how to properly terminate the session, would be helpful.

Interestingly enough, my another project is in typescript and there I can use @anthropic-ai/claude-code npm SDK package with abortController field - the issue is not presented.

Error Messages/Logs

Steps to Reproduce

Simplified call code:

let mut command = tokio::process::Command::new("/Users/USER_NAME/.nvm/versions/node/v22.18.0/bin/claude");
command
    .arg("-p --verbose --output-format=stream-json --include-partial-messages")
    .stdin(Stdio::piped())
    .stdout(Stdio::piped())
    .stderr(Stdio::piped())
    .current_dir(worktree_path);

let child = command.spawn()?;
// Write prompt to stdin and close

Simplified stop code:

// Send SIGTERM to main process (not process group)
nix::sys::signal::kill(Pid::from_raw(pid as i32), Signal::SIGTERM)?;

// Wait for process to exit
child.wait().await?;

// Additional wait for disk flush
tokio::time::sleep(Duration::from_millis(500)).await;

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.55 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

What else I've tried:

  • Using SIGTERM or SIGKILL
  • Sending signal to main process only (not process group)
  • Waiting 500ms-3s after process exit for disk flush
  • Graceful 10-second timeout before escalating signals
  • Verifying exit code is 143 (clean SIGTERM)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreautocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions