Hmbown/CodeWhale · error

fleet task objective cannot be empty

Error message

fleet task {} objective cannot be empty

What it means

If a fleet task supplies an optional `objective`, it must be non-empty. validate_task_spec_document (crates/tui/src/fleet/task_spec.rs:174) bails when objective is present but trims to empty, preventing meaningless objectives from entering a run.

Solutions

  1. Fill in a real objective string, or remove the objective key entirely
  2. Fix the generator to omit objective when unset
  3. Re-validate the document

Example fix

# before
[[tasks]]
id = "build"
instructions = "Run build"
objective = "  "
# after
[[tasks]]
id = "build"
instructions = "Run build"
objective = "Produce a clean release binary"
Defensive patterns

Strategy: validation

Validate before calling

if let Some(o) = &task.objective {
    if o.trim().is_empty() {
        return Err(format!("task {} has empty objective; set it or remove the key", task.id));
    }
}

Try / catch

match load_task_spec_document(path) {
    Ok(doc) => doc,
    Err(e) if e.to_string().contains("objective cannot be empty") => {
        eprintln!("{}: supply an objective or delete the key", path.display());
        return;
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: A [[tasks]] block sets `objective = ""` or whitespace; the document passes through load_task_spec_document or create_queued_run_with_descriptor.

Common situations: Copy-pasted blocks with an objective key left blank; generators that always emit the objective key even when no value was provided.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/fleet/task_spec.rs:174

        );
    }
    if doc.tasks.is_empty() {
        bail!("fleet task spec must include at least one task");
    }
    let mut ids = BTreeSet::new();
    for task in &doc.tasks {
        validate_fleet_identity("task id", &task.id)?;
        if !ids.insert(task.id.clone()) {
            bail!("duplicate fleet task id {}", task.id);
        }
        validate_fleet_name(&format!("task {} name", task.id), &task.name)?;
        if task.instructions.trim().is_empty() {
            bail!("fleet task {} instructions cannot be empty", task.id);
        }
        if let Some(objective) = &task.objective
            && objective.trim().is_empty()
        {
            bail!("fleet task {} objective cannot be empty", task.id);
        }
        validate_worker_profile(&task.id, task.worker.as_ref())?;
        if task
            .metadata
            .contains_key(super::worker_runtime::FROZEN_FLEET_MEMBER_METADATA_KEY)
        {
            bail!(
                "fleet task {} metadata key {} is reserved for the durable Runtime selection receipt",
                task.id,
                super::worker_runtime::FROZEN_FLEET_MEMBER_METADATA_KEY
            );
        }
        validate_tags(&task.id, &task.tags)?;
        validate_workspace_requirements(task)?;
    }
    let mut worker_ids = BTreeSet::new();
    for worker in &doc.workers {
        validate_fleet_identity("worker id", &worker.id)?;

View on GitHub (pinned to 73e0f67d83)