{"record":{"id":"713ce48e1de5859b","repo":"Stirling-Tools/Stirling-PDF","slug":"default-team-not-found","errorCode":null,"errorMessage":"Default team not found","messagePattern":"Default team not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/editor/src/proprietary/components/shared/config/configSections/TeamDetailsSection.tsx","lineNumber":177,"sourceCode":"  const handleRemoveMember = async (user: User) => {\n    if (\n      !window.confirm(\n        t(\n          \"workspace.teams.confirmRemove\",\n          `Remove ${user.username} from this team?`,\n        ),\n      )\n    ) {\n      return;\n    }\n\n    try {\n      setProcessing(true);\n      // Find the Default team ID\n      const defaultTeam = allTeams.find((t) => t.name === \"Default\");\n\n      if (!defaultTeam) {\n        throw new Error(\"Default team not found\");\n      }\n\n      // Move user to Default team by updating their role with the Default team ID\n      await teamService.moveUserToTeam(\n        user.username,\n        user.rolesAsString || \"ROLE_USER\",\n        defaultTeam.id,\n      );\n      alert({\n        alertType: \"success\",\n        title: t(\n          \"workspace.teams.removeMemberSuccess\",\n          \"User removed from team\",\n        ),\n      });\n      fetchTeamDetails();\n    } catch (error: unknown) {\n      console.error(\"Failed to remove member:\", error);","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/frontend/editor/src/proprietary/components/shared/config/configSections/TeamDetailsSection.tsx#L159-L195","documentation":"Thrown by TeamDetailsSection.handleRemoveMember when allTeams does not contain a team named 'Default'. The remove-member flow does not delete users; it reassigns them to the 'Default' team, so the Default team must exist. This is a data-integrity / configuration assumption, not a transient error.","triggerScenarios":"The workspace has no team named exactly 'Default'. The team list (allTeams) is empty (not yet loaded). The 'Default' team was renamed or deleted by an admin.","commonSituations":"Fresh workspace where the Default team was not seeded. allTeams not loaded yet (async fetch pending) when the user clicks Remove. Admin renamed the Default team.","solutions":["Ensure allTeams is loaded (non-empty) before enabling the Remove Member action.","Make the fallback team name configurable or use a stable team ID/type rather than a display name.","If the Default team is genuinely missing, show a clear message instructing an admin to create it."],"exampleFix":"// before\nconst defaultTeam = allTeams.find((t) => t.name === \"Default\");\nif (!defaultTeam) {\n  throw new Error(\"Default team not found\");\n}\n\n// after\nconst defaultTeam = allTeams.find((t) => t.name === \"Default\");\nif (!defaultTeam) {\n  alert({\n    alertType: \"error\",\n    title: t(\"workspace.teams.defaultMissing\", \"The Default team does not exist. An admin must create it before members can be removed.\"),\n  });\n  return;\n}","handlingStrategy":"validation","validationCode":"// Ensure teams are loaded and Default exists before enabling Remove\nconst defaultTeam = allTeams.find((t) => t.name === \"Default\");\nif (!defaultTeam) {\n  alert({ alertType: \"error\", title: \"The Default team is missing.\" });\n  return;\n}","typeGuard":"function hasDefaultTeam(teams: { name: string }[]): boolean {\n  return teams.some((t) => t.name === \"Default\");\n}","tryCatchPattern":null,"preventionTips":["Load allTeams before enabling the Remove Member action.","Reference the Default team by a stable ID/type rather than a display name.","Seed the Default team during workspace initialization."],"tags":["teams","workspace","data-integrity","validation","proprietary"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}