aaif-goose/goose · error
Session has no conversation after history modification
Error message
Session has no conversation after history modification
What it means
Companion of 316 in the same HistoryReplaced block: the re-fetch after /compact //clear succeeded, but Session.conversation is None, so there is no conversation to hand the UI. The session record on disk simply has no conversation attached — typical when the history-modifying command ran in a session that never had any messages (conversation metadata never created) or the session record lost that field.
Source
Thrown at crates/goose/src/agents/agent.rs:2047
.await?;
// Check if this was a command that modifies conversation history
let modifies_history = crate::agents::execute_commands::COMPACT_TRIGGERS
.contains(&message_text.trim())
|| message_text.trim() == "/clear";
return Ok(Box::pin(async_stream::try_stream! {
yield AgentEvent::Message(user_message);
yield AgentEvent::Message(response);
// After commands that modify history, notify UI that history was replaced
if modifies_history {
let updated_session = session_manager.get_session(&session_config.id, true)
.await
.map_err(|e| anyhow!("Failed to fetch updated session: {}", e))?;
let updated_conversation = updated_session
.conversation
.ok_or_else(|| anyhow!("Session has no conversation after history modification"))?;
yield AgentEvent::HistoryReplaced(updated_conversation);
}
}));
}
Ok(Some(resolved_message)) => {
session_manager
.add_message(
&session_config.id,
&user_message.clone().with_visibility(true, false),
)
.await?;
session_manager
.add_message(
&session_config.id,
&resolved_message.clone().with_visibility(false, true),
)
.await?;
}View on GitHub (pinned to 3810898a74)
Solutions
- Send at least one normal message before issuing /clear or /compact so the session has a conversation
- If the session should have messages, inspect its stored record for a missing conversation field and repair or recreate it
- Treat the error as benign for genuinely empty sessions and continue without the HistoryReplaced event
Defensive patterns
Strategy: validation
Validate before calling
// Guard history-modifying commands on sessions that actually have a conversation:
let session = session_manager.get_session(&session_id, true).await?;
if session.conversation.is_none() {
anyhow::bail!("session {session_id} has no conversation; nothing to clear");
} Type guard
fn no_conversation(e: &anyhow::Error) -> bool {
e.to_string().contains("has no conversation")
} Prevention
- Send a normal first message before /clear or /compact in fresh sessions
- Create sessions through the standard chat entry point so conversation metadata is initialized
- Treat missing conversation on an 'empty' session as expected, not fatal
When it happens
Trigger: Issuing /clear (or a COMPACT_TRIGGERS command) as the very first input of a freshly created session whose record has conversation: None; session created via API without an initial exchange; older or externally-written session records missing the conversation field.
Common situations: Automation scripts creating empty sessions and immediately sending /clear; imported/migrated sessions with incomplete metadata.
Related errors
- Failed to fetch updated session: {}
- Session {} has no conversation
- Request not found: {}
- Extension state serialization failed: {}
- Failed to persist extension state: {}
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/fdbc95fdf7f169cf.
Report an issue: GitHub.