tinyhumansai/openhuman · error · TeamError

task cannot depend on itself

Error message

task {task_id} cannot depend on itself

What it means

validate_dependencies rejects a task whose depends_on list contains its own id (TeamError::SelfDependency). A self-edge would deadlock the scheduler — the task could never have its dependency satisfied. Faulting input is the new task's depends_on slice containing new_task_id.

Solutions

  1. Remove the task's own id from its depends_on list
  2. If the intent was ordering against a different task, reference that task's id instead
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/agent/orchestration/agent_teams/ops.rs:404 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/f83a4ce6de8fae40. Report an issue: GitHub.

Appendix: source

Thrown at src/openhuman/agent/orchestration/agent_teams/ops.rs:404

    })
}

/// Validate a new task's dependency edges against the team's existing tasks.
///
/// Rejects self-dependency, unknown dependency ids, and any edge that would
/// introduce a cycle. The cycle check builds the full graph (existing tasks +
/// the new task with its proposed deps) and runs Kahn's algorithm — the same
/// shape used for workflow phase graphs in `workflow_runs::ops::has_cycle`.
fn validate_dependencies(
    new_task_id: &str,
    depends_on: &[String],
    existing: &[AgentTeamTask],
) -> Result<()> {
    let known: HashSet<&str> = existing.iter().map(|t| t.id.as_str()).collect();

    for dep in depends_on {
        if dep == new_task_id {
            return Err(anyhow!(TeamError::SelfDependency {
                task_id: new_task_id.to_string(),
            }));
        }
        if !known.contains(dep.as_str()) {
            return Err(anyhow!(TeamError::UnknownDependency {
                depends_on: dep.clone(),
            }));
        }
    }

    if has_task_cycle(new_task_id, depends_on, existing) {
        return Err(anyhow!(TeamError::CyclicDependency));
    }

    Ok(())
}

/// Kahn's-algorithm cycle check over the task dependency graph (existing tasks

View on GitHub (pinned to 7491200858)