Hmbown/CodeWhale · error

fleet task instructions cannot be empty

Error message

fleet task {} instructions cannot be empty

What it means

Each fleet task must carry non-empty instructions. validate_task_spec_document (crates/tui/src/fleet/task_spec.rs:169) rejects a task whose `instructions` field is empty or whitespace-only, since instructions are what the worker executes.

Solutions

  1. Write concrete instructions in the task's `instructions` field
  2. Fix the upstream variable/templating that produced an empty prompt
  3. Validate the spec before queueing

Example fix

# before
[[tasks]]
id = "build"
instructions = ""
# after
[[tasks]]
id = "build"
instructions = "Run cargo build --release and report failures"
Defensive patterns

Strategy: validation

Validate before calling

if task.instructions.trim().is_empty() {
    return Err(format!("task {} needs non-empty instructions", task.id));
}

Try / catch

match load_task_spec_document(path) {
    Ok(doc) => doc,
    Err(e) if e.to_string().contains("instructions cannot be empty") => {
        eprintln!("{}: fill in the task instructions", path.display());
        return;
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: A [[tasks]] block has `instructions = ""`, only whitespace, or the key omitted and defaulted to empty, when the document is validated.

Common situations: Template blocks left with placeholder-empty instructions; YAML/TOML generators emitting empty strings when a prompt variable is unset.

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

Appendix: source

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

pub fn validate_task_spec_document(doc: &FleetTaskSpecDocument) -> Result<()> {
    if doc.security_policy.is_some() {
        bail!(
            "fleet task spec security_policy is a legacy compatibility field, not executable Fleet identity; configure trust, secrets, approvals, sandboxing, and tool authority through Runtime policy"
        );
    }
    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)?;

View on GitHub (pinned to 73e0f67d83)