{"record":{"id":"e94bc04126428e1e","repo":"hcengineering/platform","slug":"status-id-is-required-when-creating-in-static-mode","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/lead/src/spaceType.ts","lineNumber":120,"sourceCode":"    core.space.Model,\n    {\n      baseClass: plugin.class.Lead,\n      allowCreate: true,\n      description: plugin.string.Lead,\n      icon: plugin.icon.Lead,\n      name: plugin.string.Lead\n    },\n    plugin.descriptors.Lead\n  )\n\n  const defaultStatuses: Ref<Status>[] = []\n\n  // Create statuses for the default task type\n  for (const status of defaultLeadStatuses) {\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":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/models/lead/src/spaceType.ts#L102-L138","documentation":"When the lead model's defineSpaceType creates its default task type, it registers each defaultLeadStatuses entry as a static Status doc. Static statuses must have a predefined id so they are stable across deployments; if id is undefined the model builder cannot create the status and throws, naming the offending status.","triggerScenarios":"Adding or editing an entry in defaultLeadStatuses in the lead model without assigning a literal id; a typo like 'ide' or a conditionally undefined id expression.","commonSituations":"Contributing a new lead status (e.g. a new pipeline stage) and forgetting the id; merging model changes where someone removed the id; TypeScript not catching it because the status objects are loosely typed at the call site.","solutions":["Add a unique literal id to the offending status entry in defaultLeadStatuses (models/lead/src/spaceType.ts / plugin config).","Check all entries of defaultLeadStatuses for undefined ids before createModel runs.","If a status is dynamic, move it out of the default (static) status list into runtime status creation instead."],"exampleFix":"// before\n{ name: 'Blocked', color: '#f00', category: LeadStatusCategory.New } // id missing\n// after\n{ name: 'Blocked', color: '#f00', id: 'blocked', category: LeadStatusCategory.New }","handlingStrategy":"validation","validationCode":"defaultLeadStatuses.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 status has a non-empty id","Type the status entries so id is required, not optional","Review model PRs for the id field when adding statuses"],"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"}