{"record":{"id":"a5ece062a00e6165","repo":"Hmbown/CodeWhale","slug":"fleet-capture-cannot-resume-a-session","errorCode":null,"errorMessage":"Fleet capture cannot resume a session","messagePattern":"Fleet capture cannot resume a session","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/exec_agent.rs","lineNumber":347,"sourceCode":"    let fleet_authority_active = fleet_authority.is_some();\n    let outer_network_access = fleet_authority\n        .as_ref()\n        .and_then(|authority| authority.network_access);\n    let outer_shell_authority = fleet_authority\n        .as_ref()\n        .map(|authority| authority.shell)\n        .unwrap_or_default();\n    if let Some(envelope) = fleet_authority {\n        crate::tools::spec::install_process_tool_authority(envelope).map_err(anyhow::Error::msg)?;\n    }\n\n    let fleet_capture = match (\n        std::env::var(\"CODEWHALE_FLEET_CAPTURE_ID\").ok(),\n        std::env::var_os(\"CODEWHALE_FLEET_CAPTURE_DIR\"),\n    ) {\n        (Some(id), Some(dir)) => {\n            uuid::Uuid::parse_str(&id).context(\"invalid Fleet session capture id\")?;\n            anyhow::ensure!(\n                resume_session.is_none(),\n                \"Fleet capture cannot resume a session\"\n            );\n            let manager = SessionManager::new(PathBuf::from(dir))?;\n            match manager.load_session(&id) {\n                Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}\n                _ => anyhow::bail!(\"Fleet session capture id is already in use or unavailable\"),\n            }\n            Some((id, manager))\n        }\n        (None, None) => None,\n        _ => anyhow::bail!(\"incomplete Fleet session capture destination\"),\n    };\n\n    let route = resolve_cli_exec_route(config, model, prompt, force_configured_route).await?;\n    let execution_config = config_for_cli_route(config, &route);\n    let auto_model = route.auto_model;\n    let effective_provider = route.provider;","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/exec_agent.rs#L329-L365","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ncodewhale --resume abc123   # with CODEWHALE_FLEET_CAPTURE_ID set\n// after\nenv -u CODEWHALE_FLEET_CAPTURE_ID -u CODEWHALE_FLEET_CAPTURE_DIR codewhale --resume abc123","handlingStrategy":"validation","validationCode":"let capturing = std::env::var_os(\"CODEWHALE_FLEET_CAPTURE_ID\").is_some()\n    && std::env::var_os(\"CODEWHALE_FLEET_CAPTURE_DIR\").is_some();\nlet resuming = resume_session.is_some();\nif capturing && resuming {\n    return Err(anyhow!(\"Fleet capture and --resume are mutually exclusive\"));\n}","typeGuard":null,"tryCatchPattern":"match run_exec_agent(args).await {\n    Err(e) if e.to_string().contains(\"Fleet capture cannot resume\") => {\n        eprintln!(\"disable Fleet capture env vars or drop --resume\");\n        std::process::exit(2);\n    }\n    other => other?,\n}","preventionTips":["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."],"tags":["fleet","session","conflicting-options","env-var"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}