hcengineering/platform · error
Invalid tag data
Error message
Invalid tag data
What it means
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.
Source
Thrown at packages/importer/src/huly/cards.ts:404
const childTagConfig = yaml.load(fs.readFileSync(childTagPath, 'utf8')) as Record<string, any>
if (childTagConfig?.class === card.class.Tag) {
await this.processTag(childTagPath, childTagConfig, result, parentMasterTagId, parentTagId)
}
}
}
private async createTag (
data: Record<string, any>,
filePath: string,
masterTagId: Ref<MasterTag>,
parentTagId?: Ref<Tag>
): Promise<UnifiedDoc<Tag>> {
this.validateFormat(data, TagSchema, filePath)
const { class: _class, title } = data
if (_class !== card.class.Tag) {
throw new Error('Invalid tag data')
}
return {
_class: card.class.Tag,
props: {
_id: this.metadataRegistry.getRef(filePath) as Ref<Tag>,
space: core.space.Model,
extends: parentTagId ?? masterTagId,
label: ('embedded:embedded:' + title) as IntlString,
kind: 2,
icon: card.icon.Tag
}
}
}
private async createAttributes (
currentPath: string,
data: Record<string, any>,View on GitHub (pinned to 63e28dc964)
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.
Example fix
// before (YAML header) class: card:class:MasterTag // after class: card:class:Tag
Defensive patterns
Strategy: type-guard
Validate before calling
function assertTagFile(header: { class?: string }): boolean {
return header.class === 'card:class:Tag' // match card.class.Tag for your version
} Type guard
function isTagData(d: { class?: string; title?: string }): d is { class: typeof card.class.Tag; title: string } {
return d.class === card.class.Tag && typeof d.title === 'string'
} Try / catch
try {
await processor.tag(file)
} catch (e) {
if (e instanceof Error && e.message === 'Invalid tag data') {
console.error(`${file}: class header is not card.class.Tag — check for MasterTag/typo mixups`)
} else throw e
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Bulk-importing a folder where tag files were templated from master-tag files; class renamed across importer versions; hand-edited headers.
Related errors
- Unsupported card type: ${cardType} in ${cardPath}
- Invalid master tag data
- Unsupported type: ${property.type} ${currentPath}
- Invalid workspace: \n${errors}
- Invalid ${type} at ${path}: \n${errors.map((e) => ` * ${e
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/9c20f323ff92e18e.
Report an issue: GitHub.