{"record":{"id":"e60ddd018d8bc58e","repo":"hcengineering/platform","slug":"status-not-found","errorCode":null,"errorMessage":"Status not found","messagePattern":"Status not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/board-resources/src/components/CreateCard.svelte","lineNumber":55,"sourceCode":"\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)\n\n    const number = (incResult as any).object.sequence\n\n    const value: AttachedData<BoardCard> = {\n      status: status._id,\n      number,\n      title,\n      kind,","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/plugins/board-resources/src/components/CreateCard.svelte#L37-L73","documentation":"createCard in CreateCard.svelte throws 'Status not found' when no core.class.Status document exists for space: sp.type. Card creation needs at least one status (typically the first by rank) to assign to the new card; a board type without any defined statuses cannot accept cards.","triggerScenarios":"Querying statuses with { space: sp.type } returns an empty result because the board's type (task type) was never initialized with default statuses, or its statuses were deleted.","commonSituations":"Custom/newly created task types missing the default status seed data, migrations that dropped statuses, or boards created against a type whose status initialization step failed.","solutions":["Initialize default statuses for the board's task type (run the plugin's seed/init routine that creates statuses for sp.type).","Verify the board's type reference is correct — statuses may exist under a different space id.","Check for deletions of Status documents and restore them.","Guard the UI: disable card creation for types that have no statuses and prompt an admin to configure them."],"exampleFix":"// before\nconst status = await client.findOne(core.class.Status, { space: sp.type }, { sort: { rank: SortingOrder.Ascending } })\nif (status === undefined) {\n  throw new Error('Status not found')\n}\n// after\nconst status = await client.findOne(core.class.Status, { space: sp.type }, { sort: { rank: SortingOrder.Ascending } })\nif (status === undefined) {\n  await ensureDefaultStatuses(client, sp.type) // seed defaults for this type\n  status = await client.findOne(core.class.Status, { space: sp.type }, { sort: { rank: SortingOrder.Ascending } })\n}","handlingStrategy":"validation","validationCode":"const status = await client.findOne(core.class.Status, { space: sp.type }, { sort: { rank: SortingOrder.Ascending } })\nif (status === undefined) {\n  throw new Error(`Task type ${sp.type} has no statuses; seed defaults before allowing card creation`)\n}","typeGuard":"function typeHasStatuses(statuses: Status[]): statuses is [Status, ...Status[]] {\n  return statuses.length > 0\n}","tryCatchPattern":"try {\n  await createCard()\n} catch (err) {\n  if (err instanceof Error && err.message === 'Status not found') {\n    ui.notify('This board type has no statuses configured. Ask an admin to set them up.')\n  } else throw err\n}","preventionTips":["Always run the status seed/init routine when creating a new task type.","Disable card creation in the UI for types without statuses.","Include Status documents in backup/restore and migration checks."],"tags":["missing-record","status","seed-data","board"],"backgroundTag":"missing-status-record","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}