{"record":{"id":"8cb184278363abee","repo":"hcengineering/platform","slug":"sequence-object-not-found-8cb184","errorCode":null,"errorMessage":"sequence object not found","messagePattern":"sequence object not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"plugins/board-resources/src/components/CreateCard.svelte","lineNumber":62,"sourceCode":"  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,\n      identifier: `CARD-${number}`,\n      rank: '',\n      assignee: null,\n      description: '',\n      members: [],\n      location: '',\n      startDate: null,","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/plugins/board-resources/src/components/CreateCard.svelte#L44-L80","documentation":"CreateCard.svelte looks up the Sequence object attached to `board.class.Card` via `client.findOne`. The Sequence object is what allocates incrementing card numbers; if no such sequence exists in the database, creation cannot continue and this error is thrown. It usually means the project/space was not properly initialized with sequence objects.","triggerScenarios":"`client.findOne(core.class.Sequence, { attachedTo: board.class.Card })` returns undefined — no Sequence object exists for the Card class in this workspace.","commonSituations":"Fresh or migrated workspaces where a seeding/upgrade routine did not create sequences, sequences deleted by maintenance scripts, or querying in a space where sequences were never generated.","solutions":["Run the platform's sequence initialization/upgrade routine so a Sequence is attached to board.class.Card.","Manually create the missing Sequence object for the Card class via an admin script or migration.","Verify the findOne query targets the same project/class used when the sequence was seeded."],"exampleFix":"// before\nconst sequence = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })\nif (sequence === undefined) throw new Error('sequence object not found')\n// after\nlet sequence = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })\nif (sequence === undefined) {\n  sequence = await client.createDoc(core.class.Sequence, board.space, { attachedTo: board.class.Card, sequence: 0 })\n}","handlingStrategy":"try-catch","validationCode":"const sequence = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })\nif (sequence === undefined) {\n  // initialize or bail out before proceeding\n}","typeGuard":"function sequenceExists(s: Sequence | undefined): s is Sequence { return s !== undefined }","tryCatchPattern":"try {\n  await createCard(title, kind)\n} catch (e) {\n  if (e instanceof Error && e.message === 'sequence object not found') {\n    ui.notify('Card numbering is not initialized; run workspace upgrade')\n  } else throw e\n}","preventionTips":["Run the workspace upgrade/initialization routine after creating or importing workspaces.","Monitor for missing Sequence documents as part of workspace health checks.","Avoid deleting seed objects like sequences during data cleanup."],"tags":["data-model","missing-data","sequence"],"backgroundTag":"missing-sequence-object","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}