Hmbown/CodeWhale · error
incomplete Fleet session capture destination
Error message
incomplete Fleet session capture destination
What it means
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.
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.
Example fix
// before export CODEWHALE_FLEET_CAPTURE_ID=$(uuidgen) # dir missing // after export CODEWHALE_FLEET_CAPTURE_ID=$(uuidgen) export CODEWHALE_FLEET_CAPTURE_DIR=/var/lib/codewhale/fleet-captures
Defensive patterns
Strategy: validation
Validate before calling
# Fail fast in the launcher before invoking codewhale
if { [ -n "$CODEWHALE_FLEET_CAPTURE_ID" ] || [ -n "$CODEWHALE_FLEET_CAPTURE_DIR" ]; } \
&& { [ -z "$CODEWHALE_FLEET_CAPTURE_ID" ] || [ -z "$CODEWHALE_FLEET_CAPTURE_DIR" ]; }; then
echo "set both CODEWHALE_FLEET_CAPTURE_ID and CODEWHALE_FLEET_CAPTURE_DIR or neither"; exit 2
fi Try / catch
Err(e) if e.to_string().contains("incomplete Fleet session capture destination") =>
eprintln!("export both CODEWHALE_FLEET_CAPTURE_ID and CODEWHALE_FLEET_CAPTURE_DIR, or neither"); Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- {}: {detail}
- Fleet session capture id is already in use or unavailable
- pass --all to stop all fleet work
- pass --all to stop all Fleet work
- A positive pull request number is required
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/e1348430306944f4.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/exec_agent.rs:359
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;
let effective_model = route.model;
let validated_route = crate::route_runtime::resolve_runtime_route(
&execution_config,
effective_provider,
Some(&effective_model),
)
.map_err(anyhow::Error::msg)?
.validate()
.map_err(anyhow::Error::msg)?;
let effective_provider_name = validated_route.identity.key.clone();
let effective_provider_id = validated_route.identity.exact_id.clone();
let (effective_provider_kind, effective_stream_provider_id) =View on GitHub (pinned to 73e0f67d83)