{"record":{"id":"0ba918d30675226c","repo":"hcengineering/platform","slug":"sequence-object-not-found-0ba918","errorCode":null,"errorMessage":"sequence object not found","messagePattern":"sequence object not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/board-resources/src/utils/CardUtils.ts","lineNumber":22,"sourceCode":"  type TxOperations as Client,\n  type TxResult,\n  type Ref,\n  type Space,\n  type AttachedData,\n  type Status\n} from '@hcengineering/core'\nimport { showPanel } from '@hcengineering/ui'\nimport board from '../plugin'\n\nexport async function createCard (\n  client: Client,\n  space: Ref<Space>,\n  status: Ref<Status>,\n  attribues: Partial<AttachedData<Card>> & { kind: Card['kind'] }\n): Promise<Ref<Card>> {\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  const number = (incResult as any).object.sequence\n\n  const value: AttachedData<Card> = {\n    title: '',\n    status,\n    startDate: null,\n    dueDate: null,\n    number,\n    rank: '',\n    assignee: null,\n    identifier: `CARD-${number}`,\n    description: '',\n    ...attribues\n  }\n","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/plugins/board-resources/src/utils/CardUtils.ts#L4-L40","documentation":"Creating a board Card requires a Sequence document attached to board.class.Card to assign the card's number. When findOne on core.class.Sequence returns undefined, numbering is impossible and this error is thrown. It indicates missing seed data in the workspace.","triggerScenarios":"Calling createCard in a workspace where the Sequence attached to board.class.Card was never created or was deleted.","commonSituations":"Newly provisioned workspace without board sequence bootstrap; data migration dropped Sequence docs; test environments built from partial fixtures; admin cleanup removed Sequence objects.","solutions":["Create the missing Sequence document attached to board.class.Card","Re-run workspace seed/initialization that registers sequences","Restore Sequence documents from backup"],"exampleFix":"// before: error thrown because sequence missing\n// after: ensure sequence exists\nlet seq = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })\nif (seq === undefined) {\n  await client.createDoc(core.class.Sequence, core.space.Model, { attachedTo: board.class.Card, sequence: 0 })\n}\nawait createCard(...)","handlingStrategy":"validation","validationCode":"const seq = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })\nif (seq === undefined) throw new Error('Board card sequence not seeded')","typeGuard":"const isSequence = (s: Sequence | undefined): s is Sequence => s !== undefined","tryCatchPattern":"try {\n  await createCard(client, space, status, attrs)\n} catch (err) {\n  if ((err as Error).message === 'sequence object not found') {\n    await seedCardSequence(client) // create missing Sequence, then retry\n    return createCard(client, space, status, attrs)\n  } else throw err\n}","preventionTips":["Ensure board workspace bootstrap creates the Card sequence","Add an integration test asserting Sequence exists before card creation","Avoid manual deletion of Sequence documents in production data"],"tags":["database","missing-data","board"],"backgroundTag":"sequence-object-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}