hcengineering/platform · error · Error
kind is not specified
Error message
kind is not specified
What it means
Thrown in CreateLead.svelte when the `kind` variable (Ref<TaskType>) is still undefined at creation time. The Lead requires a kind/task-type reference to be assigned, and the code refuses to create the lead without one.
Source
Thrown at plugins/lead-resources/src/components/CreateLead.svelte:92
}
$: if (_space === undefined) {
if (funnels.find((it) => it._id === _space) === undefined) {
_space = funnels[0]?._id
}
}
$: funnel = funnels.find((it) => it._id === _space)
let kind: Ref<TaskType> | undefined = undefined
async function createLead () {
const sequence = await client.findOne(core.class.Sequence, { attachedTo: lead.class.Lead })
if (sequence === undefined || customer == null) {
throw new Error('Lead creation failed')
}
if (kind === undefined) {
throw new Error('kind is not specified')
}
const incResult = await client.update(sequence, { $inc: { sequence: 1 } }, true)
const number = (incResult as any).object.sequence
const value: AttachedData<Lead> = {
status: state,
number,
identifier: `LEAD-${number}`,
title,
kind,
rank: '',
assignee: null,
startDate: null,
dueDate: null,
...object
}
View on GitHub (pinned to 63e28dc964)
Solutions
- Choose a kind in the dialog before clicking create
- Disable the submit button until `kind` is set (validate in canClose or form logic)
- Ensure lead TaskType objects exist and are loaded (run plugin seed/migration)
- Catch the error and prompt the user to select a kind
Example fix
// before
if (kind === undefined) {
throw new Error('kind is not specified')
}
// after
if (kind === undefined) {
ui.notify('Please select a lead kind before creating')
return
} Defensive patterns
Strategy: validation
Validate before calling
if (kind === undefined) {
ui.notify('Kind is required')
return
}
await createLead() Type guard
function hasKind (kind: Ref<TaskType> | undefined): kind is Ref<TaskType> {
return kind !== undefined
} Try / catch
try {
await createLead()
} catch (err) {
if (err instanceof Error && err.message === 'kind is not specified') {
ui.notify('Please pick a lead kind and try again.')
} else throw err
} Prevention
- Disable submit until all required selectors are filled
- Validate in canClose() before allowing dialog close-and-create
- Ensure TaskType docs are seeded so the kind dropdown is never empty
- Add a default kind when only one option exists
When it happens
Trigger: User submits the CreateLead form without picking a kind from the selector, or the kinds list failed to load leaving `kind` undefined even after an attempted selection.
Common situations: TaskType documents not seeded in the workspace so the dropdown is empty; UI allows submit while kind selector is untouched; event binding failure leaving the variable unset.
Related errors
- Lead creation failed
- Please select initial state:${_space}
- kind is not specified
- Please select initial state:${_space}
- Failed to load server config
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/fd4861141d283354.
Report an issue: GitHub.