aaif-goose/goose · info

Export canceled

Error message

Export canceled

What it means

The interactive export picker appends a literal 'Cancel' item; when the user selects it, the flow returns this anyhow error (hence a non-zero exit code) even though it is a normal, user-initiated abort. It is control flow expressed as an error, not a malfunction.

Source

Thrown at crates/goose-cli/src/commands/session.rs:412

            let display_text = format!("{} - {} ({})", s.updated_at, truncated_desc, s.id);
            (display_text, s.clone())
        })
        .collect();

    // Add each session as an option
    for display_text in display_map.keys() {
        selector = selector.item(display_text.clone(), display_text.clone(), "");
    }

    // Add a cancel option
    let cancel_value = String::from("cancel");
    selector = selector.item(cancel_value, "Cancel", "Cancel export");

    // Get user selection
    let selected_display_text: String = selector.interact()?;

    if selected_display_text == "cancel" {
        return Err(anyhow::anyhow!("Export canceled"));
    }

    // Retrieve the selected session
    if let Some(session) = display_map.get(&selected_display_text) {
        Ok(session.id.clone())
    } else {
        Err(anyhow::anyhow!("Invalid selection"))
    }
}

View on GitHub (pinned to 3810898a74)

Solutions

  1. Re-run and pick a session, or press the selector's quit key instead
  2. Pass the session ID directly to `goose session export <id>` to skip the prompt entirely

Example fix

# before
goose session export        # picker -> Cancel -> Err
# after
goose session export 20260101_000000_full-id -f json
Defensive patterns

Strategy: try-catch

Try / catch

match prompt_interactive_session_selection(&sm).await {
    Err(e) if e.to_string() == "Export canceled" => {
        std::process::exit(0); // user-initiated cancel: exit clean, not as failure
    }
    other => other,
}

Prevention

When it happens

Trigger: Running `goose session export` without an ID, then choosing 'Cancel' in the selector.

Common situations: Browsing sessions interactively and backing out; scripts calling export without an ID that receive unexpected stdin content.

Related errors


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