{"record":{"id":"e1348430306944f4","repo":"Hmbown/CodeWhale","slug":"incomplete-fleet-session-capture-destination","errorCode":null,"errorMessage":"incomplete Fleet session capture destination","messagePattern":"incomplete Fleet session capture destination","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/exec_agent.rs","lineNumber":359,"sourceCode":"    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;\n    let effective_model = route.model;\n    let validated_route = crate::route_runtime::resolve_runtime_route(\n        &execution_config,\n        effective_provider,\n        Some(&effective_model),\n    )\n    .map_err(anyhow::Error::msg)?\n    .validate()\n    .map_err(anyhow::Error::msg)?;\n    let effective_provider_name = validated_route.identity.key.clone();\n    let effective_provider_id = validated_route.identity.exact_id.clone();\n    let (effective_provider_kind, effective_stream_provider_id) =","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/exec_agent.rs#L341-L377","documentation":"Fleet session capture is configured as a matched pair of environment variables: CODEWHALE_FLEET_CAPTURE_ID and CODEWHALE_FLEET_CAPTURE_DIR. run_exec_agent matches on (Some, Some) or (None, None); any other combination — one variable set and the other missing — is an incomplete destination and fails loudly rather than silently dropping capture.","triggerScenarios":"Running `codewhale exec` with exactly one of CODEWHALE_FLEET_CAPTURE_ID or CODEWHALE_FLEET_CAPTURE_DIR set in the environment (e.g. the scheduler set the id but not the directory, or vice versa).","commonSituations":"A partially updated fleet launcher script or CI job template; an operator exported only one variable by hand; one variable was unset by an environment sanitizer/wrapper while the other survived.","solutions":["Set both CODEWHALE_FLEET_CAPTURE_ID (a valid UUID) and CODEWHALE_FLEET_CAPTURE_DIR (an existing directory path) together.","If capture was not intended, unset the orphan variable so neither is set.","Fix the launcher/orchestrator template so it always exports the pair atomically.","Check wrappers (sudo, env -i, container entrypoints) that strip environment variables and whitelist both names."],"exampleFix":"// before\nexport CODEWHALE_FLEET_CAPTURE_ID=$(uuidgen)   # dir missing\n// after\nexport CODEWHALE_FLEET_CAPTURE_ID=$(uuidgen)\nexport CODEWHALE_FLEET_CAPTURE_DIR=/var/lib/codewhale/fleet-captures","handlingStrategy":"validation","validationCode":"# Fail fast in the launcher before invoking codewhale\nif { [ -n \"$CODEWHALE_FLEET_CAPTURE_ID\" ] || [ -n \"$CODEWHALE_FLEET_CAPTURE_DIR\" ]; } \\\n   && { [ -z \"$CODEWHALE_FLEET_CAPTURE_ID\" ] || [ -z \"$CODEWHALE_FLEET_CAPTURE_DIR\" ]; }; then\n  echo \"set both CODEWHALE_FLEET_CAPTURE_ID and CODEWHALE_FLEET_CAPTURE_DIR or neither\"; exit 2\nfi","typeGuard":null,"tryCatchPattern":"Err(e) if e.to_string().contains(\"incomplete Fleet session capture destination\") =>\n    eprintln!(\"export both CODEWHALE_FLEET_CAPTURE_ID and CODEWHALE_FLEET_CAPTURE_DIR, or neither\");","preventionTips":["Set the capture id/dir pair together in one launcher script, never individually in shells.","Whitelist both variable names in wrappers (sudo, env -i, containers) that sanitize the environment.","Keep the pair defined once in your CI/fleet template to avoid drift."],"tags":["fleet","environment-variables","cli","misconfiguration"],"backgroundTag":"missing-env-var","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"}