{"record":{"id":"b8e804673f6d4d38","repo":"hcengineering/platform","slug":"unsupported-card-type-cardtype-in-cardpath","errorCode":null,"errorMessage":"Unsupported card type: ${cardType} in ${cardPath}","messagePattern":"Unsupported card type: (.+?) in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/importer/src/huly/cards.ts","lineNumber":238,"sourceCode":"      }\n    }\n  }\n\n  private async processSystemTypeCards (\n    currentDir: string,\n    result: UnifiedDocProcessResult,\n    masterTagAssociaions: Map<string, AssociationMetadata>,\n    masterTagAttributes: Map<string, UnifiedDoc<Attribute<MasterTag>>>\n  ): Promise<void> {\n    const entries = fs.readdirSync(currentDir, { withFileTypes: true })\n\n    for (const entry of entries) {\n      if (entry.isFile() && entry.name.endsWith('.md')) {\n        const cardPath = path.join(currentDir, entry.name)\n        const { class: cardType, ...cardProps } = this.parser.readYamlHeader(cardPath)\n\n        if (cardType !== undefined && cardType.startsWith('card:types:') === false) {\n          throw new Error('Unsupported card type: ' + cardType + ' in ' + cardPath)\n        }\n\n        await this.processCard(result, cardPath, cardProps, cardType, masterTagAssociaions, masterTagAttributes)\n      } else if (entry.isDirectory() && (entry.name === card.types.File || entry.name === card.types.Document)) {\n        await this.processCards(path.join(currentDir, entry.name), result, masterTagAssociaions, masterTagAttributes)\n      }\n    }\n  }\n\n  private async processCard (\n    result: UnifiedDocProcessResult,\n    cardPath: string,\n    cardProps: Record<string, any>,\n    masterTagId: Ref<MasterTag>,\n    masterTagAssociaions: Map<string, AssociationMetadata>,\n    masterTagAttributes: Map<string, UnifiedDoc<Attribute<MasterTag>>>,\n    parentCardId?: Ref<Card>\n  ): Promise<void> {","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/huly/cards.ts#L220-L256","documentation":"Thrown by CardsProcessor.processSystemTypeCards while scanning a directory of markdown card files. Each .md file's YAML header must declare a `class:` whose value starts with the `card:types:` prefix; anything else (missing prefix, plain string, wrong namespace) is rejected. This guards the importer against malformed or foreign card headers that would otherwise be processed as system type cards.","triggerScenarios":"Calling processDirectory (which invokes processSystemTypeCards) on a directory containing a .md file whose YAML frontmatter has `class:` set to a value that does not start with `card:types:` (e.g. `contact:types:Person`, a typo like `card:type:Company`, or a class copied from another module).","commonSituations":"Hand-authored cards with typos in the class prefix; cards exported from a different Huly module or older version using a different namespace; template files copied from other tooling where the header class was never updated.","solutions":["Open the .md file named in the error and change its YAML header `class:` value so it starts with `card:types:` (e.g. `card:types:Company`).","If the file is not a card, remove it from the imported directory or move it outside the scan path.","Check for version drift: if cards came from an older export, re-export with the current importer or migrate class prefixes."],"exampleFix":"// before (header of broken .md)\nclass: contact:types:Person\n// after\nclass: card:types:Person","handlingStrategy":"validation","validationCode":"import fs from 'fs'\nfunction validateCardHeaders(dir: string): string[] {\n  const bad: string[] = []\n  for (const f of fs.readdirSync(dir, { recursive: true })) {\n    if (String(f).endsWith('.md')) {\n      const header = readYamlHeader(String(f)) // your parser\n      if (header.class !== undefined && !String(header.class).startsWith('card:types:')) {\n        bad.push(String(f))\n      }\n    }\n  }\n  return bad\n}","typeGuard":"function isCardTypeHeader(cls: unknown): cls is `card:types:${string}` {\n  return typeof cls === 'string' && cls.startsWith('card:types:')\n}","tryCatchPattern":"try {\n  await processor.processDirectory(dir)\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unsupported card type:')) {\n    const [, cardType, cardPath] = e.message.match(/Unsupported card type: (.+?) in (.+)$/) ?? []\n    console.error(`Fix YAML class header in ${cardPath}: got '${cardType}', expected prefix 'card:types:'`)\n  } else throw e\n}","preventionTips":["Keep card templates with the correct `class: card:types:...` header checked into the repo.","Lint .md headers in CI before running the importer.","Never copy YAML headers from other Huly modules without verifying the prefix."],"tags":["importer","yaml","validation","cards"],"backgroundTag":"unsupported-card-type","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}