microsoft/autogen · error · Error

Failed to fetch teams

Error message

Failed to fetch teams

What it means

Thrown by TeamAPI.listTeams when GET /teams/?user_id=... returns falsy status. Same envelope contract as the other studio APIs: HTTP status is not checked, only data.status. Usual causes are an unregistered user_id, auth failure, or DB error.

Source

Thrown at python/packages/autogen-studio/frontend/src/components/views/teambuilder/api.ts:32

}

export interface ComponentTestResult {
  status: boolean;
  message: string;
  data?: any;
  logs: string[];
}

export class TeamAPI extends BaseAPI {
  async listTeams(userId: string): Promise<Team[]> {
    const response = await fetch(
      `${this.getBaseUrl()}/teams/?user_id=${userId}`,
      {
        headers: this.getHeaders(),
      }
    );
    const data = await response.json();
    if (!data.status) throw new Error(data.message || "Failed to fetch teams");
    return data.data;
  }

  async getTeam(teamId: number, userId: string): Promise<Team> {
    const response = await fetch(
      `${this.getBaseUrl()}/teams/${teamId}?user_id=${userId}`,
      {
        headers: this.getHeaders(),
      }
    );
    const data = await response.json();
    if (!data.status) throw new Error(data.message || "Failed to fetch team");
    return data.data;
  }

  async createTeam(teamData: Partial<Team>, userId: string): Promise<Team> {
    const team = {
      ...teamData,

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Inspect data.message in DevTools for the backend's reason
  2. Confirm user_id matches the authenticated user and exists on the backend
  3. Verify the backend DB is migrated and reachable
  4. curl the endpoint with the Bearer token to see the raw envelope
Defensive patterns

Strategy: validation

Validate before calling

function isValidUserId(u: string | undefined | null): u is string {
  return typeof u === "string" && u.length > 0;
}

Type guard

function isTeamListEnvelope(x: unknown): x is { status: true; data: Team[] } {
  return !!x && (x as any).status === true && Array.isArray((x as any).data);
}

Try / catch

try {
  setTeams(await teamAPI.listTeams(userId));
} catch (e) {
  setTeams([]);
  notify(e instanceof Error ? e.message : "Failed to fetch teams");
}

Prevention

When it happens

Trigger: GET /teams/?user_id=X returning {status:false}: user_id unknown to the backend, token invalid/expired, or the teams table unreachable.

Common situations: Teambuilder loaded before the user record exists on a fresh backend, switching auth realms while keeping an old user_id in state, backend started against an empty/unmigrated DB.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/7bde6f18288ea4d7. Report an issue: GitHub.