mattermost-community/focalboard · error
team ID cannot be empty
Error message
team ID cannot be empty
What it means
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.
Source
Thrown at server/model/boards_and_blocks.go:16
package model
import (
"encoding/json"
"errors"
"fmt"
"io"
"github.com/mattermost/focalboard/server/utils"
"github.com/mattermost/mattermost/server/public/shared/mlog"
)
var ErrNoBoardsInBoardsAndBlocks = errors.New("at least one board is required")
var ErrNoBlocksInBoardsAndBlocks = errors.New("at least one block is required")
var ErrNoTeamInBoardsAndBlocks = errors.New("team ID cannot be empty")
var ErrBoardIDsAndPatchesMissmatchInBoardsAndBlocks = errors.New("board ids and patches need to match")
var ErrBlockIDsAndPatchesMissmatchInBoardsAndBlocks = errors.New("block ids and patches need to match")
type BlockDoesntBelongToAnyBoardErr struct {
blockID string
}
func (e BlockDoesntBelongToAnyBoardErr) Error() string {
return fmt.Sprintf("block %s doesn't belong to any board", e.blockID)
}
// BoardsAndBlocks is used to operate over boards and blocks at the
// same time
// swagger:model
type BoardsAndBlocks struct {
// The boards
// required: false
Boards []*Board `json:"boards"`View on GitHub (pinned to a84bbb65e3)
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
Example fix
// before
const payload = {boards: [board], blocks: [block]}
// after
const payload = {teamID: currentTeamId, boards: [board], blocks: [block]} Defensive patterns
Strategy: validation
Validate before calling
if (!payload.teamID || payload.teamID.trim() === '') {
throw new Error('teamID must be set before submitting boards and blocks')
} Try / catch
try {
await client.importBoardsAndBlocks(payload)
} catch (err) {
if (err.message?.includes('team ID cannot be empty')) {
console.error('Set payload.teamID to the target team')
} else throw err
} Prevention
- 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
When it happens
Trigger: POST /api/v2/boards-and-blocks (or BoardsAndBlocks.IsValid()) where BoardsAndBlocks.TeamID is "".
Common situations: 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).
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- block fields size limit exceeded
- at least one board is required
- at least one block is required
- board ids and patches need to match
- block ids and patches need to match
AI-assisted analysis of mattermost-community/focalboard@a84bbb65e3 (2026-08-30).
Data as JSON: /api/errors/8cccfdc58d1338b2.
Report an issue: GitHub.