{"record":{"id":"02244e2aa0e2694e","repo":"mattermost-community/focalboard","slug":"errorid-teamundefined","errorCode":"ErrorId.TeamUndefined","errorMessage":"TeamUndefined","messagePattern":"TeamUndefined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"webapp/src/store/initialLoad.ts","lineNumber":33,"sourceCode":"        const [me, myConfig, team, teams, boards, boardsMemberships, boardTemplates, limits] = await Promise.all([\n            client.getMe(),\n            client.getMyConfig(),\n            client.getTeam(),\n            client.getTeams(),\n            client.getBoards(),\n            client.getMyBoardMemberships(),\n            client.getTeamTemplates(),\n            client.getBoardsCloudLimits(),\n        ])\n\n        // if no me, normally user not logged in\n        if (!me) {\n            throw new Error(ErrorId.NotLoggedIn)\n        }\n\n        // if no team, either bad id, or user doesn't have access\n        if (!team) {\n            throw new Error(ErrorId.TeamUndefined)\n        }\n        return {\n            team,\n            teams,\n            boards,\n            boardsMemberships,\n            boardTemplates,\n            limits,\n            myConfig,\n        }\n    },\n)\n\nexport const initialReadOnlyLoad = createAsyncThunk(\n    'initialReadOnlyLoad',\n    async (boardId: string) => {\n        const [board, blocks] = await Promise.all([\n            client.getBoard(boardId),","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/mattermost-community/focalboard/blob/a84bbb65e32edf972856b329417096ac413518e9/webapp/src/store/initialLoad.ts#L15-L51","documentation":"initialLoad throws new Error(ErrorId.TeamUndefined) when the user is authenticated but the requested team ID does not resolve to a team the user can access. It signals either a bad team id in the URL or insufficient permission for that team.","triggerScenarios":"Visiting the app with a teamId in the URL/route that doesn't exist or the user isn't a member of; a stale deep link to a deleted team; client.getTeam(teamId) returning undefined during initialLoad.","commonSituations":"Bookmarking a team URL after the team was deleted; being removed from a team while holding an old link; typos in team IDs in links or embedded configs.","solutions":["Verify the team ID in the URL matches an existing team the user belongs to","Catch this error and redirect the user to their team list / first available team","Check that the session user actually has membership in the target team (server-side team membership)","If team IDs are generated by tooling, confirm the team was created and ID propagated correctly"],"exampleFix":"// before\nawait initialLoad(teamId) // throws TeamUndefined\n// after\ntry {\n  await initialLoad(teamId)\n} catch (e) {\n  if (e.message === 'TeamUndefined') {\n    history.replace('/teams') // fall back to team picker\n  }\n}","handlingStrategy":"try-catch","validationCode":"const team = await client.getTeam(teamId).catch(() => null)\nif (!team) {\n  history.replace('/teams')\n}","typeGuard":"function isTeamUndefinedError(e: unknown): e is Error {\n  return e instanceof Error && e.message === 'TeamUndefined'\n}","tryCatchPattern":"try {\n  await initialLoad(teamId)\n} catch (e) {\n  if (isTeamUndefinedError(e)) {\n    history.replace('/teams')\n    return\n  }\n  throw e\n}","preventionTips":["Validate team IDs from URLs before deep-linking users","Clean up links to deleted teams","Fall back to the team picker instead of failing hard","Verify user membership before navigating directly to a team"],"tags":["typescript","frontend","routing","permissions"],"backgroundTag":"resource-not-found","analyzedSha":"a84bbb65e32edf972856b329417096ac413518e9","analyzedAt":"2026-08-30T09:22:20.720Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}