mattermost-community/focalboard · error
at least one board is required
Error message
at least one board is required
What it means
ErrNoBoardsInBoardsAndBlocks is a sentinel error in the BoardsAndBlocks model. The BoardsAndBlocks.IsValid() method requires at least one board entry, and this error signals that the submitted payload contains zero boards.
Source
Thrown at server/model/boards_and_blocks.go:14
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 boardsView on GitHub (pinned to a84bbb65e3)
Solutions
- Ensure the payload includes at least one board in the Boards array before calling the API
- Add a client-side check that len(boardsAndBlocks.Boards) > 0 before submitting
- If the source list can be legitimately empty, skip the API call instead of sending an empty payload
Example fix
// before
await client.importBoardsAndBlocks({boards: [], blocks: []})
// after
if (payload.boards.length > 0) {
await client.importBoardsAndBlocks(payload)
} Defensive patterns
Strategy: validation
Validate before calling
if (!payload.boards || payload.boards.length === 0) {
throw new Error('at least one board is required before import')
} Try / catch
try {
await client.importBoardsAndBlocks(payload)
} catch (err) {
if (err.message?.includes('at least one board')) {
alert('Nothing to import: payload has no boards')
} else throw err
} Prevention
- Validate the payload shape before API calls
- Guard import flows that filter source lists
- Skip the call entirely when the collection is empty
When it happens
Trigger: POST /api/v2/boards-and-blocks (or server calls to BoardsAndBlocks.IsValid()) with an empty Boards array.
Common situations: Bulk import/upload tooling sending an empty payload; client code constructing BoardsAndBlocks from an empty list; template or archive import where the boards slice got filtered to nothing.
Related errors
- at least one block is required
- block fields size limit exceeded
- team ID cannot be empty
- 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/0e762fec209b5405.
Report an issue: GitHub.