Hmbown/CodeWhale · error

cannot create Fleet run

Error message

cannot create Fleet run: {error}

What it means

FleetManager::create_queued_run_with_descriptor refuses to create a Fleet run when the agent roster failed to load (crates/tui/src/fleet/manager.rs:374). The roster defines which agent profiles/roles tasks may select; if its source has a load error, member resolution and profile freezing cannot proceed, so the run is rejected up front rather than failing mid-dispatch. The underlying roster load error is embedded in the message.

Solutions

  1. Read the embedded {error} in the message and fix the underlying roster load problem (repair or restore the agent profile source files).
  2. Validate that all agent_profile/role selectors in the task spec exist in the roster before dispatching.
  3. Re-run after fixing config so roster.load_error() returns None.

Example fix

// before
// agents dir missing a profile referenced by task.worker.agent_profile
let report = manager.create_queued_run_with_descriptor(doc, 4, descriptor)?;
// after
// restore/repair the profile file (e.g. .agents/reviewer.md) or drop the selector, then retry
let report = manager.create_queued_run_with_descriptor(doc, 4, descriptor)?;
Defensive patterns

Strategy: validation

Validate before calling

if let Some(err) = manager.agent_roster().load_error() {
    return Err(anyhow!("roster unavailable: {err}")); // fix roster files before creating runs
}

Try / catch

match manager.create_queued_run_with_descriptor(doc, max, desc) {
    Ok(report) => report,
    Err(e) if e.to_string().starts_with("cannot create Fleet run") => { /* surface embedded roster error to the user */ }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Calling create_queued_run / create_queued_run_with_descriptor while the agent roster's backing files are missing, unreadable, or malformed, so roster.load_error() returns Some — e.g. a broken agents directory, bad YAML/frontmatter in a profile definition, or permission problems.

Common situations: A user edited or deleted agent profile files referenced by the task spec's agent_profile/role selectors; a misconfigured agents path in settings; a partially-written roster file after an interrupted sync or version upgrade.

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/4c61d68b3f755aed. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/fleet/manager.rs:374

        max_workers: usize,
    ) -> Result<FleetRunReport> {
        self.create_queued_run_with_descriptor(
            doc,
            max_workers,
            ManagedFleetRunDescriptor::default(),
        )
    }

    pub fn create_queued_run_with_descriptor(
        &self,
        mut doc: FleetTaskSpecDocument,
        max_workers: usize,
        descriptor: ManagedFleetRunDescriptor,
    ) -> Result<FleetRunReport> {
        validate_task_spec_document(&doc)?;
        let roster = self.agent_roster();
        if let Some(error) = roster.load_error() {
            bail!("cannot create Fleet run: {error}");
        }
        for task in &doc.tasks {
            if let Some(worker) = &task.worker
                && let Some(selector) = worker.agent_profile.as_deref().or(worker.role.as_deref())
            {
                roster.resolve_member(selector)?;
            }
        }
        worker_runtime::freeze_fleet_task_members(
            &mut doc.tasks,
            roster.members(),
            roster.is_exact_selection(),
        )?;
        worker_runtime::validate_task_agent_profiles(&doc.tasks, roster.members())?;
        worker_runtime::validate_fleet_task_routes(
            &doc.tasks,
            roster.members(),
            self.session_model(),

View on GitHub (pinned to 73e0f67d83)