Hmbown/CodeWhale · error

fleet task {task_id} tag cannot be empty

Error message

fleet task {task_id} tag cannot be empty

What it means

validate_tags walks a task's tags array and rejects any entry that is empty after trimming. Tags index tasks for filtering and reporting, so blank tags are refused; duplicate tags are refused by the adjacent check.

Source

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

    Ok(receipt)
}

pub fn record_verification_receipt(
    ledger: &FleetLedger,
    workspace: &Path,
    input: &FleetTaskVerificationInput,
    verification: FleetTaskVerification,
) -> Result<FleetReceipt> {
    let receipt = prepare_verification_receipt(workspace, input, verification)?;
    ledger.record_receipt(receipt.clone())?;
    Ok(receipt)
}

fn validate_tags(task_id: &str, tags: &[String]) -> Result<()> {
    let mut seen = BTreeSet::new();
    for tag in tags {
        if tag.trim().is_empty() {
            bail!("fleet task {task_id} tag cannot be empty");
        }
        if !seen.insert(tag) {
            bail!("fleet task {task_id} has duplicate tag {tag}");
        }
    }
    Ok(())
}

fn validate_workspace_requirements(task: &FleetTaskSpec) -> Result<()> {
    let Some(workspace) = &task.workspace else {
        return Ok(());
    };
    let env = workspace.environment.as_ref();
    for name in env
        .into_iter()
        .flat_map(|env| env.required.iter().chain(env.allowlist.iter()))
    {
        if name.trim().is_empty() {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Remove empty and whitespace-only entries from the task's tags array
  2. Filter out blank segments when generating tags by splitting strings
  3. While editing, also de-duplicate tags to avoid the sibling duplicate-tag error

Example fix

// before
{ "id": "t1", "instructions": "...", "tags": ["", "backend"] }

// after
{ "id": "t1", "instructions": "...", "tags": ["backend"] }
Defensive patterns

Strategy: validation

Validate before calling

fn tags_valid(tags: &[String]) -> bool {
    tags.iter().all(|t| !t.trim().is_empty())
        && tags.iter().collect::<std::collections::BTreeSet<_>>().len() == tags.len()
}

Type guard

function tagsValid(tags: string[]): boolean {
  return (
    tags.every((t) => t.trim().length > 0) &&
    new Set(tags).size === tags.length
  );
}

Try / catch

if let Err(err) = load_task_spec_document(&path) {
    if err.to_string().contains("tag cannot be empty") {
        eprintln!("{path:?}: remove blank entries from the task's tags array");
    }
    return Err(err);
}

Prevention

When it happens

Trigger: A task with "tags": [""] or "tags": [" ", "backend"] - any single blank entry fails the whole spec.

Common situations: Tag lists built by string splitting where an empty segment slips in ("a,,b"); templates with placeholder empty tags; copy-paste leaving a stray comma-quoted empty element.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/7e8c5a7e478ae99c. Report an issue: GitHub.