hcengineering/platform · critical

sequence object not found

Error message

sequence object not found

What it means

CopyCard.svelte needs the Sequence object for `board.class.Card` to allocate a number for the duplicated card. If the sequence document cannot be found, copying aborts with this error. Like the other sequence errors, it signals a missing/uninitialized data object rather than a coding bug in the copy flow.

Source

Thrown at plugins/board-resources/src/components/popups/CopyCard.svelte:35

  const hierarchy = client.getHierarchy()
  const dispatch = createEventDispatcher()

  let inputRef: TextArea
  let title = value.title
  let status: Status = OK
  const selected = {
    space: value.space,
    status: value.status,
    rank: value.rank
  }

  async function copyCard (): Promise<void> {
    const newCardId = generateId()

    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 copy: AttachedData<Card> = {
      status: selected.status,
      number: (incResult as any).object.sequence,
      title,
      rank: selected.rank,
      assignee: null,
      description: '',
      members: [],
      location: '',
      labels: value.labels,
      startDate: value.startDate,
      dueDate: value.dueDate
    }

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Execute the workspace upgrade routine to seed Sequence objects for cards.
  2. Insert the missing Sequence document manually via an admin script.
  3. Confirm the environment points at the intended database (staging vs prod) that actually has sequences.

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
const sequence = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })
if (sequence === undefined) {
  ui.notify('Card numbering is not initialized; run workspace upgrade')
  return
}
Defensive patterns

Strategy: try-catch

Validate before calling

const sequence = await client.findOne(core.class.Sequence, { attachedTo: board.class.Card })
if (sequence === undefined) { ui.notify('Sequence missing for cards'); return }

Type guard

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

Try / catch

try {
  await copyCard()
} catch (e) {
  if (e instanceof Error && e.message === 'sequence object not found') {
    ui.notify('Card copy failed: numbering sequence not initialized')
  } else throw e
}

Prevention

When it happens

Trigger: `client.findOne(core.class.Sequence, { attachedTo: board.class.Card })` returns undefined when the user triggers card copy in the popup.

Common situations: Newly provisioned or imported workspaces missing seed data, sequences removed by data cleanup, or running against a DB snapshot that predates sequence creation.

Related errors


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