aaif-goose/goose · error · anyhow::Error

Cannot use --session-id without --resume

Error message

Cannot use --session-id without --resume

What it means

anyhow error from the non-resume branch (crates/goose-cli/src/cli.rs). When starting a fresh chat, the code checks that no --session-id was supplied: a session id only makes sense with --resume, so 'goose --session-id X' without --resume is rejected before any session is created.

Source

Thrown at crates/goose-cli/src/cli.rs:451

                })?
        } else {
            return Err(anyhow::anyhow!("Invalid identifier"));
        }
    } else {
        let Some(id) = identifier else {
            let session = session_manager
                .create_session(
                    std::env::current_dir()?,
                    "CLI Session".to_string(),
                    SessionType::User,
                    goose_mode,
                )
                .await?;
            return Ok(Some(session.id));
        };

        if id.session_id.is_some() {
            return Err(anyhow::anyhow!("Cannot use --session-id without --resume"));
        }

        let has_user_provided_name = id.name.is_some();
        let name = id.name.unwrap_or_else(|| "CLI Session".to_string());
        let session = session_manager
            .create_session(
                std::env::current_dir()?,
                name.clone(),
                SessionType::User,
                goose_mode,
            )
            .await?;

        if has_user_provided_name {
            session_manager
                .update(&session.id)
                .user_provided_name(name)
                .apply()

View on GitHub (pinned to 3810898a74)

Solutions

  1. Add --resume: goose --resume --session-id 20250921_143022
  2. If you wanted a new named session, use -n/--name instead of --session-id
  3. Drop --session-id entirely to start a fresh unnamed session

Example fix

# before
goose --session-id 20250921_143022

# after
goose --resume --session-id 20250921_143022
Defensive patterns

Strategy: validation

Validate before calling

if args.session_id.is_some() && !args.resume {
    return Err(anyhow::anyhow!("--session-id requires --resume"));
}

Prevention

When it happens

Trigger: Running 'goose --session-id 20250921_143022' (or the --id alias) without --resume; same for 'goose run ... --session-id ...' style invocations where a new session would otherwise be created.

Common situations: Copy-pasting a resume command and dropping the --resume flag; assuming --session-id seeds a new session's id (it does not — ids are generated); shell scripts that always pass --session-id.

Related errors


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