Hmbown/CodeWhale · error

fleet task environment variable name cannot be empty

Error message

fleet task {} environment variable name cannot be empty

What it means

Fleet task spec validation rejects an empty or whitespace-only environment variable name in the task workspace's required or allowlisted env list. A blank name cannot be resolved or injected into the worker environment, so the spec is rejected.

Solutions

  1. Remove blank entries from environment.required and environment.allowlist.
  2. Trim and filter env-name inputs at spec build time.
  3. Give the env entry a real variable name or drop it.

Example fix

// before
"environment": {"required": ["API_KEY", ""]}
// after
"environment": {"required": ["API_KEY"]}
Defensive patterns

Strategy: validation

Validate before calling

fn env_names_valid(env: &Environment) -> bool { env.required.iter().chain(env.allowlist.iter()).all(|n| !n.trim().is_empty()) }

Type guard

fn valid_env_name(n: &str) -> bool { !n.trim().is_empty() }

Prevention

When it happens

Trigger: Calling validate_task_spec_document where workspace.environment.required or workspace.environment.allowlist contains "" or " ".

Common situations: Hand-edited workspace config with an empty list entry; generated specs where an env-name field defaulted to empty string; splitting a comma-separated env list that had an empty segment (e.g. "FOO,,BAR").

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

Appendix: source

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

        }
        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() {
            bail!(
                "fleet task {} environment variable name cannot be empty",
                task.id
            );
        }
    }
    Ok(())
}

fn verify_exit_code(exit_code: Option<i32>) -> FleetTaskVerification {
    match exit_code {
        Some(0) => pass("exit_code=0"),
        Some(code) => fail(
            FleetTaskFailureKind::Task,
            0.0,
            format!("exit_code={code}"),
            "worker task exited unsuccessfully",
        ),
        None => fail(

View on GitHub (pinned to 73e0f67d83)