hcengineering/platform · error

kind is not specified

Error message

kind is not specified

What it means

CreateCard.svelte throws this when the incoming `kind` parameter is undefined while creating a new card in a board. The card creation flow needs an explicit sequence kind to know which numbering sequence to apply; without it the operation is stopped before any object is written. It is a caller-contract error, not a system failure.

Source

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

  }

  let kind: Ref<TaskType> | undefined = undefined

  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,

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Ensure the caller selects a kind before invoking the create handler (disable the submit button until kind is set).
  2. Supply a sensible default kind value in the caller or component props.
  3. Add a type check/validation on the input so undefined kind never reaches the create path.

Example fix

// before
onCreate(title)
// after
if (kind === undefined) { showWarning('Select a kind'); return }
onCreate(title, kind)
Defensive patterns

Strategy: validation

Validate before calling

if (kind === undefined) { ui.notify('Select a kind first'); return }
// safe to call create handler now

Type guard

function hasKind<T>(kind: T | undefined): kind is T { return kind !== undefined }

Try / catch

try {
  await createCard(title, kind)
} catch (e) {
  if (e instanceof Error && e.message === 'kind is not specified') ui.notify('Please select a kind')
  else throw e
}

Prevention

When it happens

Trigger: Calling the card-creation handler (e.g. from the popup UI) without selecting/supplying a kind value, so `kind === undefined` when the function runs.

Common situations: Custom UI invoking the create handler directly, a form where the kind selector was skipped or not yet initialized, or a refactor that removed the kind argument/default.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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