{"record":{"id":"8cccfdc58d1338b2","repo":"mattermost-community/focalboard","slug":"team-id-cannot-be-empty","errorCode":null,"errorMessage":"team ID cannot be empty","messagePattern":"team ID cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/model/boards_and_blocks.go","lineNumber":16,"sourceCode":"package model\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/mattermost/focalboard/server/utils\"\n\n\t\"github.com/mattermost/mattermost/server/public/shared/mlog\"\n)\n\nvar ErrNoBoardsInBoardsAndBlocks = errors.New(\"at least one board is required\")\nvar ErrNoBlocksInBoardsAndBlocks = errors.New(\"at least one block is required\")\nvar ErrNoTeamInBoardsAndBlocks = errors.New(\"team ID cannot be empty\")\nvar ErrBoardIDsAndPatchesMissmatchInBoardsAndBlocks = errors.New(\"board ids and patches need to match\")\nvar ErrBlockIDsAndPatchesMissmatchInBoardsAndBlocks = errors.New(\"block ids and patches need to match\")\n\ntype BlockDoesntBelongToAnyBoardErr struct {\n\tblockID string\n}\n\nfunc (e BlockDoesntBelongToAnyBoardErr) Error() string {\n\treturn fmt.Sprintf(\"block %s doesn't belong to any board\", e.blockID)\n}\n\n// BoardsAndBlocks is used to operate over boards and blocks at the\n// same time\n// swagger:model\ntype BoardsAndBlocks struct {\n\t// The boards\n\t// required: false\n\tBoards []*Board `json:\"boards\"`","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/mattermost-community/focalboard/blob/a84bbb65e32edf972856b329417096ac413518e9/server/model/boards_and_blocks.go#L1-L34","documentation":"ErrNoTeamInBoardsAndBlocks is a sentinel error in the BoardsAndBlocks model. IsValid() requires a non-empty TeamID; this error reports that the payload's team ID is empty.","triggerScenarios":"POST /api/v2/boards-and-blocks (or BoardsAndBlocks.IsValid()) where BoardsAndBlocks.TeamID is \"\".","commonSituations":"Import tooling that didn't set the team context; clients constructing BoardsAndBlocks programmatically and forgetting TeamID; code paths where team scoping was removed in a refactor (e.g. moving from team-scoped to board-scoped APIs across versions).","solutions":["Set the TeamID field to the target team's ID before submitting","Validate teamID != \"\" client-side before calling the API","If your server version no longer requires team scoping, upgrade client and server versions together to avoid stale schema expectations"],"exampleFix":"// before\nconst payload = {boards: [board], blocks: [block]}\n// after\nconst payload = {teamID: currentTeamId, boards: [board], blocks: [block]}","handlingStrategy":"validation","validationCode":"if (!payload.teamID || payload.teamID.trim() === '') {\n  throw new Error('teamID must be set before submitting boards and blocks')\n}","typeGuard":null,"tryCatchPattern":"try {\n  await client.importBoardsAndBlocks(payload)\n} catch (err) {\n  if (err.message?.includes('team ID cannot be empty')) {\n    console.error('Set payload.teamID to the target team')\n  } else throw err\n}","preventionTips":["Always populate teamID from the active team context","Add a schema/type check requiring teamID on payloads","Align client and server versions to avoid schema drift"],"tags":["go","validation","bad-request"],"backgroundTag":"missing-required-field","analyzedSha":"a84bbb65e32edf972856b329417096ac413518e9","analyzedAt":"2026-08-30T09:22:20.720Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}