Hmbown/CodeWhale · error
Fleet capture cannot resume a session
Error message
Fleet capture cannot resume a session
What it means
When Fleet capture mode is enabled via CODEWHALE_FLEET_CAPTURE_ID and CODEWHALE_FLEET_CAPTURE_DIR, exec_agent runs a fresh captured session. Combining capture with an existing resume_session is contradictory — capture cannot both record a new session and resume an old one — so the run aborts.
Solutions
- Unset CODEWHALE_FLEET_CAPTURE_ID and CODEWHALE_FLEET_CAPTURE_DIR when resuming a session.
- Drop the --resume flag if the run is intended to be a fresh captured Fleet session.
- Scope the capture env vars to the specific fleet invocation rather than exporting them globally.
Example fix
// before codewhale --resume abc123 # with CODEWHALE_FLEET_CAPTURE_ID set // after env -u CODEWHALE_FLEET_CAPTURE_ID -u CODEWHALE_FLEET_CAPTURE_DIR codewhale --resume abc123
Defensive patterns
Strategy: validation
Validate before calling
let capturing = std::env::var_os("CODEWHALE_FLEET_CAPTURE_ID").is_some()
&& std::env::var_os("CODEWHALE_FLEET_CAPTURE_DIR").is_some();
let resuming = resume_session.is_some();
if capturing && resuming {
return Err(anyhow!("Fleet capture and --resume are mutually exclusive"));
} Try / catch
match run_exec_agent(args).await {
Err(e) if e.to_string().contains("Fleet capture cannot resume") => {
eprintln!("disable Fleet capture env vars or drop --resume");
std::process::exit(2);
}
other => other?,
} Prevention
- Never export CODEWHALE_FLEET_CAPTURE_* globally; scope them per invocation.
- Document that capture mode implies a fresh session.
- In wrappers/scripts, unset capture vars when passing --resume.
When it happens
Trigger: Setting both CODEWHALE_FLEET_CAPTURE_ID/CODEWHALE_FLEET_CAPTURE_DIR in the environment AND passing a resume session (e.g. `--resume <id>` or an equivalent programmatic resume_session value) into run_exec_agent.
Common situations: A fleet orchestration script exports capture env vars globally while a developer also runs a manual resume command in the same shell; CI inherits capture variables from a parent environment and then performs session resume tests.
Related errors
- fleet alert secret is not configured
- fleet alert URL is not configured
- agent profile cannot be empty
- agent profile must be a simple token
- agent profile may not disable approval_required
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/a5ece062a00e6165.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/exec_agent.rs:347
let fleet_authority_active = fleet_authority.is_some();
let outer_network_access = fleet_authority
.as_ref()
.and_then(|authority| authority.network_access);
let outer_shell_authority = fleet_authority
.as_ref()
.map(|authority| authority.shell)
.unwrap_or_default();
if let Some(envelope) = fleet_authority {
crate::tools::spec::install_process_tool_authority(envelope).map_err(anyhow::Error::msg)?;
}
let fleet_capture = match (
std::env::var("CODEWHALE_FLEET_CAPTURE_ID").ok(),
std::env::var_os("CODEWHALE_FLEET_CAPTURE_DIR"),
) {
(Some(id), Some(dir)) => {
uuid::Uuid::parse_str(&id).context("invalid Fleet session capture id")?;
anyhow::ensure!(
resume_session.is_none(),
"Fleet capture cannot resume a session"
);
let manager = SessionManager::new(PathBuf::from(dir))?;
match manager.load_session(&id) {
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}
_ => anyhow::bail!("Fleet session capture id is already in use or unavailable"),
}
Some((id, manager))
}
(None, None) => None,
_ => anyhow::bail!("incomplete Fleet session capture destination"),
};
let route = resolve_cli_exec_route(config, model, prompt, force_configured_route).await?;
let execution_config = config_for_cli_route(config, &route);
let auto_model = route.auto_model;
let effective_provider = route.provider;View on GitHub (pinned to 73e0f67d83)