{"record":{"id":"a4d31ab0658b539e","repo":"hcengineering/platform","slug":"status-id-is-required-when-creating-in-static-mode-a4d31a","errorCode":null,"errorMessage":"Status id is required when creating in static model. Missing for: ${name}","messagePattern":"Status id is required when creating in static model\\. Missing for: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"models/recruit/src/spaceType.ts","lineNumber":111,"sourceCode":"    core.space.Model,\n    {\n      baseClass: plugin.class.Applicant,\n      allowCreate: true,\n      description: plugin.string.Application,\n      icon: plugin.icon.Application,\n      name: plugin.string.Application\n    },\n    plugin.descriptors.Application\n  )\n\n  const defaultStatuses: Ref<Status>[] = []\n\n  // Create statuses for the default task type\n  for (const status of defaultApplicantStatuses) {\n    const { name, color, ofAttribute, id, category } = status\n\n    if (id === undefined) {\n      throw new Error('Status id is required when creating in static model. Missing for: ' + name)\n    }\n\n    defaultStatuses.push(id)\n\n    builder.createDoc(\n      core.class.Status,\n      core.space.Model,\n      {\n        ofAttribute,\n        name,\n        color,\n        category\n      },\n      id\n    )\n  }\n\n  // Create default task type","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/models/recruit/src/spaceType.ts#L93-L129","documentation":"Identical validation to the lead model but for recruit: defineSpaceType iterates defaultApplicantStatuses and requires each static status to have a defined id so a Status doc can be created with builder.createDoc(core.class.Status, ...). Missing ids break the recruit model build deterministically.","triggerScenarios":"An entry in defaultApplicantStatuses lacks a literal id when the recruit model is created; occurs at model build/upgrade time via createModel -> defineSpaceType.","commonSituations":"Adding a new applicant hiring status without an id; copy-pasting a status entry and deleting the id line; data-driven statuses accidentally placed in the static defaults list.","solutions":["Assign a literal unique id to every entry in defaultApplicantStatuses in models/recruit/src/spaceType.ts.","Audit the statuses list for undefined ids (console.log or a unit test asserting ids exist).","Create genuinely dynamic statuses at runtime rather than in the static defaults array."],"exampleFix":"// before\n{ name: 'No Show', color: '#888', category: ApplicantStatusCategory.Lost }\n// after\n{ name: 'No Show', color: '#888', id: 'no-show', category: ApplicantStatusCategory.Lost }","handlingStrategy":"validation","validationCode":"defaultApplicantStatuses.forEach(s => {\n  if (s.id === undefined) throw new Error(`status '${s.name}' missing id`)\n})","typeGuard":"function hasStaticId(s: { id?: string }): s is { id: string } & typeof s {\n  return typeof s.id === 'string' && s.id.length > 0\n}","tryCatchPattern":null,"preventionTips":["Add a unit test asserting every default applicant status has an id","Make id a required field on the status entry type","Keep dynamic statuses out of the static defaults array"],"tags":["configuration","model-definition","status"],"backgroundTag":"missing-static-status-id","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}