{"record":{"id":"bde186e8e67264d8","repo":"hcengineering/platform","slug":"issue-status-not-found-name","errorCode":null,"errorMessage":"Issue status not found: ${name}","messagePattern":"Issue status not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/importer/src/importer/importer.ts","lineNumber":1018,"sourceCode":"\n    const markup = jsonToMarkup(processedJson)\n\n    const result = await this.fileUploader.uploadCollaborativeDoc(collabId, markup)\n    if (result.success) {\n      return result.id\n    }\n    throw new Error('Failed to upload collaborative document: ' + id)\n  }\n\n  async findIssueStatusByName (name: string): Promise<Ref<IssueStatus>> {\n    const query: DocumentQuery<Status> = {\n      name,\n      ofAttribute: tracker.attribute.IssueStatus\n    }\n\n    const status = await this.client.findOne(tracker.class.IssueStatus, query)\n    if (status === undefined) {\n      throw new Error('Issue status not found: ' + name)\n    }\n\n    return status._id\n  }\n\n  async uniqueProjectIdentifier (baseIdentifier: string): Promise<string> {\n    const projects = await this.client.findAll(tracker.class.Project, {})\n    const projectsIdentifiers = new Set(projects.map(({ identifier }) => identifier))\n\n    let identifier = baseIdentifier\n    let i = 1\n    while (projectsIdentifiers.has(identifier)) {\n      identifier = `${baseIdentifier}${i}`\n      i++\n    }\n    return identifier\n  }\n","sourceCodeStart":1000,"sourceCodeEnd":1036,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/importer/importer.ts#L1000-L1036","documentation":"findIssueStatusByName looks up a tracker IssueStatus by exact name and throws when client.findOne returns undefined. The importer requires every referenced status name to exist in the target workspace before mapping imported issues.","triggerScenarios":"Calling WorkspaceImporter.findIssueStatusByName(name) (directly or during issue import) where no IssueStatus document with that exact name and ofAttribute: tracker.attribute.IssueStatus exists in the workspace.","commonSituations":"Importing from another tool (Jira/Asana/etc.) whose status names were not pre-created in the target workspace; case/whitespace mismatch between source and target status names; statuses deleted or renamed after mapping was configured.","solutions":["Create the missing IssueStatus in the target workspace with the exact name before importing.","Compare the name string for exact match (case, trailing spaces) against existing statuses via client.findAll(tracker.class.IssueStatus, {}).","Add a normalization/mapping step that translates source statuses to workspace statuses with a default fallback.","Pre-fetch all IssueStatus names and validate the import mapping up front, failing early with the full list of missing statuses."],"exampleFix":"// before\nconst status = await this.client.findOne(tracker.class.IssueStatus, { name, ofAttribute: tracker.attribute.IssueStatus })\nif (status === undefined) {\n  throw new Error('Issue status not found: ' + name)\n}\n// after\nlet status = await this.client.findOne(tracker.class.IssueStatus, { name, ofAttribute: tracker.attribute.IssueStatus })\nif (status === undefined) {\n  status = await this.client.findOne(tracker.class.IssueStatus, { name: name.trim().toLowerCase(), ofAttribute: tracker.attribute.IssueStatus })\n}\nif (status === undefined) {\n  throw new Error('Issue status not found: ' + name)\n}","handlingStrategy":"validation","validationCode":"const statuses = await client.findAll(tracker.class.IssueStatus, { ofAttribute: tracker.attribute.IssueStatus })\nconst known = new Set(statuses.map(s => s.name))\nconst missing = requiredStatusNames.filter(n => !known.has(n))\nif (missing.length > 0) throw new Error('Missing issue statuses: ' + missing.join(', '))","typeGuard":"function hasStatus<T extends { name: string }>(statuses: T[], name: string): T | undefined {\n  return statuses.find(s => s.name === name)\n}","tryCatchPattern":"try {\n  const statusRef = await importer.findIssueStatusByName(name)\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Issue status not found:')) {\n    await createMissingStatus(name) // provision then retry\n  } else throw err\n}","preventionTips":["Pre-create all source-tool statuses in the target workspace before import","Match names exactly: normalize case/whitespace in your mapping config","Validate the full status mapping up front instead of lazily per issue","Keep a default fallback status for unmapped names"],"tags":["lookup","tracker","import","missing-data"],"backgroundTag":"entity-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}