{"record":{"id":"20714d39dcb4618b","repo":"microsoft/autogen","slug":"failed-to-create-team","errorCode":null,"errorMessage":"Failed to create team","messagePattern":"Failed to create team","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-studio/frontend/src/components/views/teambuilder/api.ts","lineNumber":60,"sourceCode":"    );\n    const data = await response.json();\n    if (!data.status) throw new Error(data.message || \"Failed to fetch team\");\n    return data.data;\n  }\n\n  async createTeam(teamData: Partial<Team>, userId: string): Promise<Team> {\n    const team = {\n      ...teamData,\n      user_id: userId,\n    };\n\n    const response = await fetch(`${this.getBaseUrl()}/teams/`, {\n      method: \"POST\",\n      headers: this.getHeaders(),\n      body: JSON.stringify(team),\n    });\n    const data = await response.json();\n    if (!data.status) throw new Error(data.message || \"Failed to create team\");\n    return data.data;\n  }\n\n  async deleteTeam(teamId: number, userId: string): Promise<void> {\n    const response = await fetch(\n      `${this.getBaseUrl()}/teams/${teamId}?user_id=${userId}`,\n      {\n        method: \"DELETE\",\n        headers: this.getHeaders(),\n      }\n    );\n    const data = await response.json();\n    if (!data.status) throw new Error(data.message || \"Failed to delete team\");\n  }\n}\n\n// move validationapi to its own class\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-studio/frontend/src/components/views/teambuilder/api.ts#L42-L78","documentation":"Thrown by TeamAPI.createTeam when POST /teams/ returns falsy status. It force-injects user_id and POSTs the team JSON; failure means backend validation of the team component graph (agents, model configs, termination conditions) or persistence failed.","triggerScenarios":"POST /teams/ with a partially built team (agent missing its model reference, invalid component type strings), user_id unknown, or DB write failure — all surface as {status:false}.","commonSituations":"Saving a team straight from the builder with an incomplete agent (no model attached), component schema drift after backend upgrade rejecting the serialized team, saving before required fields are filled.","solutions":["Read data.message — component validation errors are relayed from the backend","Complete required team fields: every agent needs a model component; termination must be set","Test the exact payload with curl against /teams/ to see raw validation output","If schema drift, rebuild the team in the UI against the current backend version rather than re-POSTing an old export"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// require every agent to reference a model before saving\nfunction isTeamComplete(team: Partial<Team>): boolean {\n  const agents = team?.component?.components?.agents ?? [];\n  return agents.length > 0 && agents.every(a => a?.component?.components?.model != null);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await teamAPI.createTeam(teamData, userId);\n} catch (e) {\n  notify(`Team not saved: ${e instanceof Error ? e.message : e}`);\n  return null;\n}","preventionTips":["Gate the Save button on required team structure (agents have models, termination set)","Keep exported team JSON versioned; re-validate against the current backend schema on import","Send only fields defined by the backend Team model"],"tags":["teams","http","validation","error-envelope"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}