aaif-goose/goose · error · anyhow::Error
session has no messages to edit
Error message
session has no messages to edit
What it means
When a session is resumed with the edit flag, goose loads the stored session record and opens its `conversation` field in an external editor via edit_conversation. Sessions that were created but never received a message have `conversation: None`, and attempting to edit them is rejected.
Source
Thrown at crates/goose-cli/src/cli.rs:1689
if let Some(ref id) = session_id {
let session_manager = SessionManager::instance();
let original = session_manager.get_session(id, true).await?;
let target_id = if fork {
let copied = session_manager
.copy_session(id, original.name.clone())
.await?;
let copied_id = copied.id.clone();
session_id = Some(copied.id);
copied_id
} else {
id.clone()
};
if edit {
let conversation = original
.conversation
.ok_or_else(|| anyhow::anyhow!("session has no messages to edit"))?;
let edited = crate::session::editor::edit_conversation(&conversation)?;
session_manager
.replace_conversation(&target_id, &edited)
.await?;
}
}
}
let mut session: crate::CliSession = build_session(SessionBuilderConfig {
session_id,
resume,
fork,
no_session: false,
extensions: extension_opts.extensions,
streamable_http_extensions: extension_opts.streamable_http_extensions,
builtins: extension_opts.builtins,
no_profile: extension_opts.no_profile,
recipe: None,View on GitHub (pinned to 3810898a74)
Solutions
- Choose a session that actually contains messages (inspect it via the session list/viewer first)
- If you want a clean slate, start a new session instead of editing an empty one
- Send at least one message in that session before attempting to edit it
Example fix
# before goose session --edit <id-of-empty-session> # error: no messages to edit # after goose session --edit <id-of-session-with-messages>
Defensive patterns
Strategy: validation
Validate before calling
# Rust (embedding goose): confirm the session actually has a conversation first
let conversation = original.conversation.as_ref().filter(|c| !c.is_empty());
if conversation.is_none() {
anyhow::bail!("cannot edit: session has no messages");
} Type guard
fn is_editable(conversation: &Option<Vec<goose::message::Message>>) -> bool {
conversation.as_ref().is_some_and(|c| !c.is_empty())
} Prevention
- Show message counts next to session ids in any session picker
- Treat empty sessions as new conversations, never edit targets
- Verify the id with `goose session list` before scripting --edit
When it happens
Trigger: Invoking the resume-with-edit path (`--edit`) targeting a session id whose stored record has no conversation; also forked/copied sessions created from an original that was empty.
Common situations: Picking a session id from `goose session list` that was opened and immediately quit before the first message; a typo resolving to an empty session; automation resuming a session that errored on startup before any turn.
Related errors
- No session found to resume
- No session found with name '{}'
- Could not extract session ID from path: {:?}
- Invalid identifier
- Cannot use --session-id without --resume
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/0fdea5cf84a07837.
Report an issue: GitHub.