tinyhumansai/openhuman · error

team missing after creation: {team_id}

Error message

team missing after creation: {team_id}

What it means

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.

Source

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

        run_ledger::shutdown_agent_team_member(&config.workspace_dir, team_id, member_id)?
            .ok_or_else(|| {
                anyhow!(TeamError::UnknownMember {
                    member_id: member_id.to_string(),
                })
            })?;
    log::debug!(
        "{LOG_PREFIX} shutdown_member.exit team={team_id} member={member_id} released={}",
        released_task_ids.len()
    );
    Ok(MemberShutdown {
        member,
        released_task_ids,
    })
}

fn team_view(config: &Config, team_id: &str) -> Result<TeamView> {
    let team = run_ledger::get_agent_team(&config.workspace_dir, team_id)?
        .ok_or_else(|| anyhow!("team missing after creation: {team_id}"))?;
    let members = run_ledger::list_agent_team_members(&config.workspace_dir, team_id)?;
    let tasks = run_ledger::list_agent_team_tasks(&config.workspace_dir, team_id)?;
    Ok(TeamView {
        team,
        members,
        tasks,
    })
}

/// 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],

View on GitHub (pinned to a221052e0d)

Solutions

  1. Retry the create_team call once — transient ledger visibility issues usually clear
  2. Verify nothing else (tests, another core, cleanup job) is deleting the run-ledger DB concurrently
  3. Inspect the workspace run-ledger database integrity (sqlite) if it reproduces
Defensive patterns

Strategy: try-catch

Try / catch

let view = match agent_teams::ops::create_team(&config, req) {
    Ok(v) => v,
    Err(e) if e.to_string().contains("team missing after creation") => {
        // re-read once; if still absent, surface as workspace/ledger corruption
        agent_teams::ops::get_team(&config, &team_id)?.context("ledger lost the team right after creation")?
    }
    Err(e) => return Err(e),
};

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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