{"record":{"id":"9c20f323ff92e18e","repo":"hcengineering/platform","slug":"invalid-tag-data","errorCode":null,"errorMessage":"Invalid tag data","messagePattern":"Invalid tag data","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/importer/src/huly/cards.ts","lineNumber":404,"sourceCode":"      const childTagConfig = yaml.load(fs.readFileSync(childTagPath, 'utf8')) as Record<string, any>\n\n      if (childTagConfig?.class === card.class.Tag) {\n        await this.processTag(childTagPath, childTagConfig, result, parentMasterTagId, parentTagId)\n      }\n    }\n  }\n\n  private async createTag (\n    data: Record<string, any>,\n    filePath: string,\n    masterTagId: Ref<MasterTag>,\n    parentTagId?: Ref<Tag>\n  ): Promise<UnifiedDoc<Tag>> {\n    this.validateFormat(data, TagSchema, filePath)\n\n    const { class: _class, title } = data\n    if (_class !== card.class.Tag) {\n      throw new Error('Invalid tag data')\n    }\n\n    return {\n      _class: card.class.Tag,\n      props: {\n        _id: this.metadataRegistry.getRef(filePath) as Ref<Tag>,\n        space: core.space.Model,\n        extends: parentTagId ?? masterTagId,\n        label: ('embedded:embedded:' + title) as IntlString,\n        kind: 2,\n        icon: card.icon.Tag\n      }\n    }\n  }\n\n  private async createAttributes (\n    currentPath: string,\n    data: Record<string, any>,","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/huly/cards.ts#L386-L422","documentation":"Thrown by CardsProcessor.createTag when the document's `class` field is not card.class.Tag, mirroring the master-tag check. Schema validation has already passed, so this indicates the right shape but the wrong document kind was routed to tag creation.","triggerScenarios":"Calling tag (which delegates to createTag) with data whose YAML `class:` header is anything other than card.class.Tag — commonly a MasterTag or Card document, or a class from another module namespace.","commonSituations":"Bulk-importing a folder where tag files were templated from master-tag files; class renamed across importer versions; hand-edited headers.","solutions":["Change the file's `class:` header to the exact card.class.Tag value.","Send MasterTag documents to the masterTag factory instead.","Diff the class string against the importer's card.class constants to catch case/namespace drift."],"exampleFix":"// before (YAML header)\nclass: card:class:MasterTag\n// after\nclass: card:class:Tag","handlingStrategy":"type-guard","validationCode":"function assertTagFile(header: { class?: string }): boolean {\n  return header.class === 'card:class:Tag' // match card.class.Tag for your version\n}","typeGuard":"function isTagData(d: { class?: string; title?: string }): d is { class: typeof card.class.Tag; title: string } {\n  return d.class === card.class.Tag && typeof d.title === 'string'\n}","tryCatchPattern":"try {\n  await processor.tag(file)\n} catch (e) {\n  if (e instanceof Error && e.message === 'Invalid tag data') {\n    console.error(`${file}: class header is not card.class.Tag — check for MasterTag/typo mixups`)\n  } else throw e\n}","preventionTips":["Route by `class` field when bulk-importing mixed directories.","Diff class strings against card.class constants after importer upgrades.","Template tag files separately from master-tag files to avoid header copy-paste errors."],"tags":["importer","validation","tag"],"backgroundTag":"mismatched-document-class","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}