{"record":{"id":"f83a4ce6de8fae40","repo":"tinyhumansai/openhuman","slug":"task-task-id-cannot-depend-on-itself","errorCode":null,"errorMessage":"task {task_id} cannot depend on itself","messagePattern":"task (.+?) cannot depend on itself","errorType":"validation","errorClass":"TeamError","httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/orchestration/agent_teams/ops.rs","lineNumber":404,"sourceCode":"    })\n}\n\n/// Validate a new task's dependency edges against the team's existing tasks.\n///\n/// Rejects self-dependency, unknown dependency ids, and any edge that would\n/// introduce a cycle. The cycle check builds the full graph (existing tasks +\n/// the new task with its proposed deps) and runs Kahn's algorithm — the same\n/// shape used for workflow phase graphs in `workflow_runs::ops::has_cycle`.\nfn validate_dependencies(\n    new_task_id: &str,\n    depends_on: &[String],\n    existing: &[AgentTeamTask],\n) -> Result<()> {\n    let known: HashSet<&str> = existing.iter().map(|t| t.id.as_str()).collect();\n\n    for dep in depends_on {\n        if dep == new_task_id {\n            return Err(anyhow!(TeamError::SelfDependency {\n                task_id: new_task_id.to_string(),\n            }));\n        }\n        if !known.contains(dep.as_str()) {\n            return Err(anyhow!(TeamError::UnknownDependency {\n                depends_on: dep.clone(),\n            }));\n        }\n    }\n\n    if has_task_cycle(new_task_id, depends_on, existing) {\n        return Err(anyhow!(TeamError::CyclicDependency));\n    }\n\n    Ok(())\n}\n\n/// Kahn's-algorithm cycle check over the task dependency graph (existing tasks","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/agent/orchestration/agent_teams/ops.rs#L386-L422","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/agent/orchestration/agent_teams/ops.rs:404 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the task's own id from its depends_on list","If the intent was ordering against a different task, reference that task's id instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}