{"record":{"id":"01246b7aaf940a03","repo":"mattermost-community/focalboard","slug":"board-ids-do-not-match","errorCode":null,"errorMessage":"Board IDs do not match","messagePattern":"Board IDs do not match","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/model/card.go","lineNumber":11,"sourceCode":"package model\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\n\t\"github.com/mattermost/focalboard/server/utils\"\n\t\"github.com/rivo/uniseg\"\n)\n\nvar ErrBoardIDMismatch = errors.New(\"Board IDs do not match\")\n\ntype ErrInvalidCard struct {\n\tmsg string\n}\n\nfunc NewErrInvalidCard(msg string) ErrInvalidCard {\n\treturn ErrInvalidCard{\n\t\tmsg: msg,\n\t}\n}\n\nfunc (e ErrInvalidCard) Error() string {\n\treturn fmt.Sprintf(\"invalid card, %s\", e.msg)\n}\n\nvar ErrNotCardBlock = errors.New(\"not a card block\")\n\ntype ErrInvalidFieldType struct {","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/mattermost-community/focalboard/blob/a84bbb65e32edf972856b329417096ac413518e9/server/model/card.go#L1-L29","documentation":"ErrBoardIDMismatch is a sentinel error in the Card model indicating that the card's board ID does not match the board ID of the request/path context. It is treated as a bad request (IsErrBadRequest) and surfaced by handlers such as handleCreateCard.","triggerScenarios":"POST /api/v2/cards (handleCreateCard) where the card payload's boardId differs from the boardId in the request URL; any card IsValid-style check comparing card.BoardID with an expected board ID.","commonSituations":"Client code copying a card between boards without updating card.BoardID; stale UI state holding an old board ID; API consumers hardcoding board IDs in payloads.","solutions":["Set the card's boardId to match the board ID in the request URL/path","If moving a card to another board, use the proper move/update flow with a consistent boardId in both payload and route","Check client state (e.g. selected board in the store) that supplied the mismatched ID"],"exampleFix":"// before\nawait client.createCard(boardIdFromUrl, {...card, boardId: oldBoardId})\n// after\nawait client.createCard(boardIdFromUrl, {...card, boardId: boardIdFromUrl})","handlingStrategy":"validation","validationCode":"if (card.boardId !== boardIdFromUrl) {\n  throw new Error('card.boardId must match the board in the request URL')\n}","typeGuard":"function hasMatchingBoardID(card, boardId) {\n  return card && card.boardId === boardId\n}","tryCatchPattern":"try {\n  await client.createCard(boardId, card)\n} catch (err) {\n  if (err.response?.status === 400 && /Board IDs do not match/.test(err.message)) {\n    console.error('Payload boardId does not match URL boardId')\n  } else throw err\n}","preventionTips":["Always construct card payloads from the active board context","Update card.boardId when moving cards between boards","Avoid hardcoding board IDs in payloads","Compare payload.boardId to the route param as an assertion in dev builds"],"tags":["go","validation","bad-request","cards"],"backgroundTag":"id-mismatch","analyzedSha":"a84bbb65e32edf972856b329417096ac413518e9","analyzedAt":"2026-08-30T09:22:20.720Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}