hcengineering/platform · critical

sequence object not found

Error message

sequence object not found

What it means

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.

Source

Thrown at plugins/board-resources/src/components/CreateCard.svelte:62

  async function createCard () {
    const sp = await client.findOne(board.class.Board, { _id: _space as Ref<Board> })
    if (sp === undefined) {
      throw new Error('Board not found')
    }
    const status = await client.findOne(
      core.class.Status,
      { space: sp.type },
      { sort: { rank: SortingOrder.Ascending } }
    )
    if (status === undefined) {
      throw new Error('Status not found')
    }
    if (kind === undefined) {
      throw new Error('kind is not specified')
    }
    const sequence = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })
    if (sequence === undefined) {
      throw new Error('sequence object not found')
    }

    const incResult = await client.update(sequence, { $inc: { sequence: 1 } }, true)

    const number = (incResult as any).object.sequence

    const value: AttachedData<BoardCard> = {
      status: status._id,
      number,
      title,
      kind,
      identifier: `CARD-${number}`,
      rank: '',
      assignee: null,
      description: '',
      members: [],
      location: '',
      startDate: null,

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Run the platform's sequence initialization/upgrade routine so a Sequence is attached to board.class.Card.
  2. Manually create the missing Sequence object for the Card class via an admin script or migration.
  3. Verify the findOne query targets the same project/class used when the sequence was seeded.

Example fix

// before
const sequence = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })
if (sequence === undefined) throw new Error('sequence object not found')
// after
let sequence = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })
if (sequence === undefined) {
  sequence = await client.createDoc(core.class.Sequence, board.space, { attachedTo: board.class.Card, sequence: 0 })
}
Defensive patterns

Strategy: try-catch

Validate before calling

const sequence = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })
if (sequence === undefined) {
  // initialize or bail out before proceeding
}

Type guard

function sequenceExists(s: Sequence | undefined): s is Sequence { return s !== undefined }

Try / catch

try {
  await createCard(title, kind)
} catch (e) {
  if (e instanceof Error && e.message === 'sequence object not found') {
    ui.notify('Card numbering is not initialized; run workspace upgrade')
  } else throw e
}

Prevention

When it happens

Trigger: `client.findOne(core.class.Sequence, { attachedTo: board.class.Card })` returns undefined — no Sequence object exists for the Card class in this workspace.

Common situations: 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.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/8cb184278363abee. Report an issue: GitHub.