{"record":{"id":"83498d09dc1be60a","repo":"hcengineering/platform","slug":"kind-is-not-specified-83498d","errorCode":null,"errorMessage":"kind is not specified","messagePattern":"kind is not specified","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/recruit-resources/src/components/CreateApplication.svelte","lineNumber":126,"sourceCode":"  const dispatch = createEventDispatcher()\n  const client = getClient()\n  const hierarchy = client.getHierarchy()\n  fillDefaults(hierarchy, doc, recruit.class.Applicant)\n\n  export function canClose (): boolean {\n    return (preserveCandidate || _candidate === undefined) && assignee === undefined\n  }\n\n  async function createApplication (): Promise<void> {\n    if (selectedState === undefined) {\n      throw new Error(`Please select initial state:${_space}`)\n    }\n    const sequence = await client.findOne(core.class.Sequence, { attachedTo: recruit.class.Applicant })\n    if (sequence === undefined) {\n      throw new Error('sequence object not found')\n    }\n    if (kind === undefined) {\n      throw new Error('kind is not specified')\n    }\n\n    const incResult = await client.update(sequence, { $inc: { sequence: 1 } }, true)\n\n    const candidateInstance = await client.findOne(contact.class.Person, { _id: _candidate })\n    if (candidateInstance === undefined) {\n      throw new Error('contact not found')\n    }\n\n    const ops = client.apply(undefined, recruitId + '.Create.CreateApplication')\n\n    if (!client.getHierarchy().hasMixin(candidateInstance, recruit.mixin.Candidate)) {\n      await ops.createMixin<Contact, Candidate>(\n        candidateInstance._id,\n        candidateInstance._class,\n        candidateInstance.space,\n        recruit.mixin.Candidate,\n        {}","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/plugins/recruit-resources/src/components/CreateApplication.svelte#L108-L144","documentation":"Thrown in CreateApplication.svelte when the `kind` variable (Ref<TaskType>) is undefined at creation time. Applications require a kind reference, and the code blocks creation until one is provided.","triggerScenarios":"User submits CreateApplication without selecting a kind; the TaskType list for the recruit plugin failed to load so no kind could be chosen; component state lost the selection on navigation.","commonSituations":"Recruit task types not seeded in the workspace; form allows submit with default-empty selector; conditional rendering skipping the kind input while create still runs.","solutions":["Pick a kind in the dialog before submitting","Seed/load recruit TaskType documents so the selector has options","Guard the submit action (canClose / button disabled) until kind is set","Catch the error and prompt for kind selection"],"exampleFix":"// before\nif (kind === undefined) {\n  throw new Error('kind is not specified')\n}\n// after\nif (kind === undefined) {\n  ui.notify('Please select an application kind')\n  return\n}","handlingStrategy":"validation","validationCode":"if (kind === undefined) {\n  ui.notify('Kind is required')\n  return\n}\nawait createApplication()","typeGuard":"function hasKind (kind: Ref<TaskType> | undefined): kind is Ref<TaskType> {\n  return kind !== undefined\n}","tryCatchPattern":"try {\n  await createApplication()\n} catch (err) {\n  if (err instanceof Error && err.message === 'kind is not specified') {\n    ui.notify('Select an application kind first.')\n  } else throw err\n}","preventionTips":["Require kind selection before enabling create","Default to the first available recruit TaskType","Seed recruit TaskTypes during plugin setup","Validate kind when switching target spaces"],"tags":["validation","missing-selection","recruit"],"backgroundTag":"required-field-missing","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}