{"record":{"id":"d92333e6df8e1119","repo":"tinyhumansai/openhuman","slug":"team-missing-after-creation-team-id","errorCode":null,"errorMessage":"team missing after creation: {team_id}","messagePattern":"team missing after creation: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/orchestration/agent_teams/ops.rs","lineNumber":379,"sourceCode":"        run_ledger::shutdown_agent_team_member(&config.workspace_dir, team_id, member_id)?\n            .ok_or_else(|| {\n                anyhow!(TeamError::UnknownMember {\n                    member_id: member_id.to_string(),\n                })\n            })?;\n    log::debug!(\n        \"{LOG_PREFIX} shutdown_member.exit team={team_id} member={member_id} released={}\",\n        released_task_ids.len()\n    );\n    Ok(MemberShutdown {\n        member,\n        released_task_ids,\n    })\n}\n\nfn team_view(config: &Config, team_id: &str) -> Result<TeamView> {\n    let team = run_ledger::get_agent_team(&config.workspace_dir, team_id)?\n        .ok_or_else(|| anyhow!(\"team missing after creation: {team_id}\"))?;\n    let members = run_ledger::list_agent_team_members(&config.workspace_dir, team_id)?;\n    let tasks = run_ledger::list_agent_team_tasks(&config.workspace_dir, team_id)?;\n    Ok(TeamView {\n        team,\n        members,\n        tasks,\n    })\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],","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/src/openhuman/agent/orchestration/agent_teams/ops.rs#L361-L397","documentation":"Internal invariant error raised by the private team_view helper: immediately after create_team upserted the team row, re-reading it via run_ledger::get_agent_team returned None. The row the code just wrote is not visible, which points at ledger/persistence trouble or concurrent interference rather than bad caller input.","triggerScenarios":"Create-team succeeding at the upsert but the follow-up read finding nothing — e.g. the run-ledger DB was deleted or reset between the two calls, two calls used different config.workspace_dir values, or a concurrent process deleted the row. Not reachable through ordinary wrong arguments.","commonSituations":"Workspace wiped/reset by a test harness or another core instance mid-call; sqlite ledger file corrupted or on a failing disk; concurrent team deletion racing creation.","solutions":["Retry the create_team call once — transient ledger visibility issues usually clear","Verify nothing else (tests, another core, cleanup job) is deleting the run-ledger DB concurrently","Inspect the workspace run-ledger database integrity (sqlite) if it reproduces"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let view = match agent_teams::ops::create_team(&config, req) {\n    Ok(v) => v,\n    Err(e) if e.to_string().contains(\"team missing after creation\") => {\n        // re-read once; if still absent, surface as workspace/ledger corruption\n        agent_teams::ops::get_team(&config, &team_id)?.context(\"ledger lost the team right after creation\")?\n    }\n    Err(e) => return Err(e),\n};","preventionTips":["Never wipe or restore the workspace run-ledger DB while team operations are in flight","Run one core per workspace_dir — concurrent writers invite read-after-write anomalies","If this fires repeatedly, check sqlite integrity of the run ledger before debugging code"],"tags":["agent-teams","internal-invariant","persistence","concurrency"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}