aaif-goose/goose · error

Session {} has no conversation

Error message

Session {} has no conversation

What it means

On the main reply path, after the user message is appended, agent.rs re-reads the session (get_session with include_messages) and expects Session.conversation to be Some so it can run compaction checks and build the reply context. This error means the session record exists but carries no conversation — the session was persisted without ever creating one.

Source

Thrown at crates/goose/src/agents/agent.rs:2078

                    .add_message(
                        &session_config.id,
                        &resolved_message.clone().with_visibility(false, true),
                    )
                    .await?;
            }
            Ok(None) => {
                session_manager
                    .add_message(&session_config.id, &user_message)
                    .await?;
            }
        }
        let session = session_manager
            .get_session(&session_config.id, true)
            .await?;
        let conversation = session
            .conversation
            .clone()
            .ok_or_else(|| anyhow::anyhow!("Session {} has no conversation", session_config.id))?;

        let needs_auto_compact = check_if_compaction_needed(
            self.provider().await?.as_ref(),
            &conversation,
            None,
            &session,
        )
        .await?;

        let conversation_to_compact = conversation.clone();
        let reply_span = tracing::Span::current();

        Ok(Box::pin(async_stream::try_stream! {
            for event in command_preamble {
                yield event;
            }

            let final_conversation = if !needs_auto_compact {

View on GitHub (pinned to 3810898a74)

Solutions

  1. Initialize new sessions with a real first exchange (create via the normal chat entry point) before calling reply
  2. Verify the session record actually contains the just-added user message; if not, storage is the problem
  3. Recreate the session if its metadata is irreparably incomplete
  4. Update goose — session-creation paths have been normalized across versions
Defensive patterns

Strategy: validation

Validate before calling

let session = session_manager.get_session(&session_id, true).await?;
if session.conversation.is_none() {
    anyhow::bail!(
        "session {session_id} was created without a conversation; initialize it with a first message"
    );
}

Type guard

fn no_conversation(e: &anyhow::Error) -> bool {
    e.to_string().contains("has no conversation")
}

Prevention

When it happens

Trigger: Replying in a session that was created empty (SessionManager create without an initial message) and whose add_message didn't yield a conversation; sessions produced by external tooling/import with conversation metadata absent; storage inconsistency where the message write and conversation field diverge.

Common situations: Programmatically created sessions (API/CLI flags) that skip the initial exchange and jump straight to agent.reply; resumed sessions whose file lost the conversation field.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/d5cf30af59eb33b2. Report an issue: GitHub.