mattermost-community/focalboard · warning · Error
ErrorId.TeamUndefined
ErrorId.TeamUndefined
Error message
TeamUndefined
What it means
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.
Source
Thrown at webapp/src/store/initialLoad.ts:33
const [me, myConfig, team, teams, boards, boardsMemberships, boardTemplates, limits] = await Promise.all([
client.getMe(),
client.getMyConfig(),
client.getTeam(),
client.getTeams(),
client.getBoards(),
client.getMyBoardMemberships(),
client.getTeamTemplates(),
client.getBoardsCloudLimits(),
])
// if no me, normally user not logged in
if (!me) {
throw new Error(ErrorId.NotLoggedIn)
}
// if no team, either bad id, or user doesn't have access
if (!team) {
throw new Error(ErrorId.TeamUndefined)
}
return {
team,
teams,
boards,
boardsMemberships,
boardTemplates,
limits,
myConfig,
}
},
)
export const initialReadOnlyLoad = createAsyncThunk(
'initialReadOnlyLoad',
async (boardId: string) => {
const [board, blocks] = await Promise.all([
client.getBoard(boardId),View on GitHub (pinned to a84bbb65e3)
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
Example fix
// before
await initialLoad(teamId) // throws TeamUndefined
// after
try {
await initialLoad(teamId)
} catch (e) {
if (e.message === 'TeamUndefined') {
history.replace('/teams') // fall back to team picker
}
} Defensive patterns
Strategy: try-catch
Validate before calling
const team = await client.getTeam(teamId).catch(() => null)
if (!team) {
history.replace('/teams')
} Type guard
function isTeamUndefinedError(e: unknown): e is Error {
return e instanceof Error && e.message === 'TeamUndefined'
} Try / catch
try {
await initialLoad(teamId)
} catch (e) {
if (isTeamUndefinedError(e)) {
history.replace('/teams')
return
}
throw e
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- ErrorId.NotLoggedIn
- ErrorId.InvalidReadOnlyBoard
- category doesn't belong to user
- cannot leave a board with no admins
- mention not permitted
AI-assisted analysis of mattermost-community/focalboard@a84bbb65e3 (2026-08-30).
Data as JSON: /api/errors/02244e2aa0e2694e.
Report an issue: GitHub.