aaif-goose/goose · error
Failed to fetch updated session: {}
Error message
Failed to fetch updated session: {} What it means
After processing a history-modifying slash command (members of execute_commands::COMPACT_TRIGGERS like /compact, or /clear), the reply stream re-fetches the session with get_session(&id, true) (include_messages) to emit a HistoryReplaced event. This error means that re-fetch failed at the SessionManager level — session record unreadable, missing, or storage error — after the command already modified history.
Source
Thrown at crates/goose/src/agents/agent.rs:2044
&session_config.id,
&response.clone().with_visibility(true, false),
)
.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),View on GitHub (pinned to 3810898a74)
Solutions
- Check the session file/record still exists and is readable in the sessions directory
- Retry the command once transient I/O is ruled out — history was already modified, so a re-fetch may succeed
- Repair or archive the corrupted session and continue in a new session
- Free disk / fix permissions on the goose config directory
Defensive patterns
Strategy: retry
Validate before calling
// Before issuing /compact or /clear, confirm the session is readable:
if session_manager.get_session(&session_id, true).await.is_err() {
anyhow::bail!("session {session_id} unreadable; fix storage before history commands");
} Type guard
fn session_fetch_failed(e: &anyhow::Error) -> bool {
e.to_string().contains("Failed to fetch updated session")
} Try / catch
// inside the try_stream: one bounded retry, then degrade gracefully
let updated = match session_manager.get_session(&session_config.id, true).await {
Ok(s) => Some(s),
Err(first) => match session_manager.get_session(&session_config.id, true).await {
Ok(s) => Some(s),
Err(_) => { tracing::error!("{first}"); None }
},
};
if let Some(s) = updated { /* yield HistoryReplaced */ } Prevention
- Don't delete or move session files while a goose session is live
- Monitor free disk and permissions on the goose config directory
- Back up the sessions directory before bulk cleanup
When it happens
Trigger: Running /compact or /clear when the session file/DB entry was deleted or moved mid-run, is corrupted (deserialization fails), or the storage backend returned an I/O error (permissions, disk).
Common situations: Session files under the goose sessions directory removed by cleanup tools while goose runs; partial writes from a crash leaving a corrupt session file; read-only or full disk; sessions synced/overwritten by another process.
Related errors
- Session has no conversation after history modification
- Request not found: {}
- Extension state serialization failed: {}
- Failed to persist extension state: {}
- Session {} has no conversation
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/13f015b821aaa8cf.
Report an issue: GitHub.