Hmbown/CodeWhale · error

write-capable sub-agent launch requires a durable…

Error message

write-capable sub-agent launch requires a durable coordination state path

What it means

Write-capable sub-agents coordinate through a durable coordination state file guarded by a process lock. If the manager was configured as requiring that lock (`coordination_process_lock_required`) but has no durable `state_path`, launching a write-capable child is refused, because concurrent writers could corrupt shared workspace state (#5036).

Solutions

  1. Initialize the SubAgentManager with a durable state_path (point it at the session's coordination/state file) before launching write-capable agents.
  2. If the work truly needs no shared-workspace coordination, set options.isolated_worktree = true so the child mutates its own checkout and bypasses the process lock.
  3. Check why the manager was built without a state path (config/env) and fix the construction site so coordination state persists.

Example fix

// before
let manager = SubAgentManager::builder().without_state_path().build();
// after
let manager = SubAgentManager::builder()
    .state_path(session_dir.join("subagents.json"))
    .build();
Defensive patterns

Strategy: validation

Validate before calling

if (writeCapableSpawn && !options.isolatedWorktree && !manager.hasDurableStatePath()) {
  throw new Error("configure state_path before launching write-capable sub-agents");
}

Prevention

When it happens

Trigger: Spawning a write-capable sub-agent (non-isolated worktree) when SubAgentManager.coordination_process_lock_required is true and self.state_path is None — i.e. the manager was constructed without a durable state file path.

Common situations: TUI/session started in a mode that skips state persistence (ephemeral or in-memory manager) while the model still requests a write-capable worker; configuration regression after refactoring manager construction; running in an environment where the state directory could not be determined.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/931c41ff919b6e31. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/tools/subagent/mod.rs:7102

                || !options
                    .write_claim
                    .as_ref()
                    .is_some_and(|claim| claim.contains_path(&claimed_path))
            {
                return Err(anyhow!(
                    "deliverable {path:?} is outside the worker write scope; declare an exact_files entry or a containing write_roots path"
                ));
            }
        }
        if write_capable {
            // Isolated-worktree children mutate their own checkout, so they
            // do not contend for the shared-workspace process lock (#5036).
            if !options.isolated_worktree {
                self.ensure_coordination_process_lock()
                    .map_err(anyhow::Error::msg)?;
            }
            if self.coordination_process_lock_required && self.state_path.is_none() {
                return Err(anyhow!(
                    "write-capable sub-agent launch requires a durable coordination state path"
                ));
            }
        }
        let durable_registration = write_capable || continuation_from.is_some();
        let durable_launch_snapshot =
            durable_registration.then(|| (self.worker_records.clone(), self.coordination.clone()));
        let persisted_claim = if write_capable {
            options
                .write_claim
                .clone()
                .map(|mut claim| {
                    claim.owner = agent_id.clone();
                    let claim = if options.claim_pre_namespaced {
                        claim
                    } else {
                        self.namespace_write_claim(
                            &agent.workspace,

View on GitHub (pinned to 73e0f67d83)