{"record":{"id":"033bfbb265c25644","repo":"hcengineering/platform","slug":"board-not-found","errorCode":null,"errorMessage":"Board not found","messagePattern":"Board not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/board-resources/src/components/CreateCard.svelte","lineNumber":47,"sourceCode":"  let _space = space\n  const status: Status = OK\n\n  let title: string = ''\n\n  const dispatch = createEventDispatcher()\n  const client = getClient()\n  const cardId = generateId<BoardCard>()\n\n  export function canClose (): boolean {\n    return title !== ''\n  }\n\n  let kind: Ref<TaskType> | undefined = undefined\n\n  async function createCard () {\n    const sp = await client.findOne(board.class.Board, { _id: _space as Ref<Board> })\n    if (sp === undefined) {\n      throw new Error('Board not found')\n    }\n    const status = await client.findOne(\n      core.class.Status,\n      { space: sp.type },\n      { sort: { rank: SortingOrder.Ascending } }\n    )\n    if (status === undefined) {\n      throw new Error('Status not found')\n    }\n    if (kind === undefined) {\n      throw new Error('kind is not specified')\n    }\n    const sequence = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })\n    if (sequence === undefined) {\n      throw new Error('sequence object not found')\n    }\n\n    const incResult = await client.update(sequence, { $inc: { sequence: 1 } }, true)","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/plugins/board-resources/src/components/CreateCard.svelte#L29-L65","documentation":"createCard in CreateCard.svelte looks up the Board document by _space id; if client.findOne(board.class.Board, { _id: _space }) returns undefined it throws 'Board not found'. The card creation UI was opened with a space reference that no longer resolves to an actual Board.","triggerScenarios":"The _space variable holds a stale/invalid Ref<Board> — the board was deleted, the user lacks access so the object isn't loaded, or _space was never set before createCard ran.","commonSituations":"Another user deleted the board while the create-card dialog was open, navigating to the dialog via a stale link, or a permission/scope issue hiding the board from the current user's client.","solutions":["Re-fetch the list of boards and have the user reopen the dialog with a valid board selected.","Check that the user has permission to read the board — a restricted board also returns undefined.","Close the dialog automatically when the underlying board is deleted (subscribe to object removal).","Log the _space value and compare it against existing board ids to identify the stale reference."],"exampleFix":"// before\nconst sp = await client.findOne(board.class.Board, { _id: _space as Ref<Board> })\nif (sp === undefined) {\n  throw new Error('Board not found')\n}\n// after\nconst sp = await client.findOne(board.class.Board, { _id: _space as Ref<Board> })\nif (sp === undefined) {\n  ui.notify('This board no longer exists or is unavailable. Please select another board.')\n  closeDialog()\n  return\n}","handlingStrategy":"type-guard","validationCode":"const sp = await client.findOne(board.class.Board, { _id: _space as Ref<Board> })\nif (sp === undefined) {\n  // board deleted, restricted, or _space unset — abort before creating\n  return\n}","typeGuard":"function isBoard(doc: Board | undefined): doc is Board {\n  return doc !== undefined && typeof doc._id === 'string' && doc._class === board.class.Board\n}","tryCatchPattern":"try {\n  await createCard()\n} catch (err) {\n  if (err instanceof Error && err.message === 'Board not found') {\n    ui.notify('This board is no longer available. Please reopen the dialog and select a board.')\n    closeDialog()\n  } else throw err\n}","preventionTips":["Refresh _space from the live model when opening the dialog, don't cache it.","Close the create-card dialog when the board is deleted (subscribe to object removal).","Verify user read permissions for the board before opening the dialog."],"tags":["ui","missing-record","stale-reference","board"],"backgroundTag":"missing-board-record","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}