{"record":{"id":"abb2b4f0b64ac2c4","repo":"hcengineering/platform","slug":"invalid-import-schema-in-filepath-errors-ma","errorCode":null,"errorMessage":"Invalid import schema in ${filePath}: \n${errors.map((e) => `    * ${e}`).join(';\\n')}\n","messagePattern":"Invalid import schema in (.+?): \n(.+?)`\\)\\.join\\(';\\\\n'\\)\\}\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/importer/src/huly/cards.ts","lineNumber":884,"sourceCode":"      isArray: true\n    })\n\n    optionalFields.set('attachments', {\n      type: PathFieldType,\n      isArray: true\n    })\n\n    return {\n      requiredFields,\n      optionalFields\n    }\n  }\n\n  private validateFormat (data: Record<string, any>, schema: FormatSchema, filePath: string): void {\n    const currentPath = path.dirname(filePath)\n    const errors = validateSchema(data, schema, currentPath)\n    if (errors.length > 0) {\n      throw new Error(\n        'Invalid import schema in ' +\n          filePath +\n          ': \\n' +\n          Array.from(errors)\n            .map((e) => `    * ${e}`)\n            .join(';\\n') +\n          '\\n'\n      )\n    }\n  }\n\n  private validateFileExists (fileAbsPath: string): void {\n    if (!fs.existsSync(fileAbsPath)) {\n      throw new Error('File not found: ' + fileAbsPath)\n    }\n  }\n}\n","sourceCodeStart":866,"sourceCodeEnd":902,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/huly/cards.ts#L866-L902","documentation":"validateFormat runs each parsed document through validateSchema against its FormatSchema; any accumulated validation errors are aggregated into this single message listing each failing check with the source file path. It means the document's YAML/structure does not conform to the expected format schema (missing required fields, wrong types, bad paths).","triggerScenarios":"Any import flow (masterTag, tag, cards) calling validateFormat with a file whose parsed data violates FormatSchema — missing required keys like `title`, wrong field types, or referenced paths failing schema-level checks.","commonSituations":"Hand-authored cards missing required header fields; renamed schema fields after an importer upgrade; YAML indentation mistakes producing wrong types (string vs number).","solutions":["Read the `* item` lines in the message — each names a specific schema violation and field; fix them in the file at <filePath>.","Compare the document's header against the corresponding FormatSchema definition (MasterTagSchema, TagSchema, etc.) for required fields and types.","Validate YAML structure/indentation — a misindented key can silently become a wrong-typed or missing field.","If schemas changed after an upgrade, migrate old files to the new schema version."],"exampleFix":"# before — missing required title\nclass: card:class:Tag\n# after\nclass: card:class:Tag\ntitle: My Tag","handlingStrategy":"validation","validationCode":"import { validateSchema } from '<importer>/schema'\nfunction prevalidate(file: string, data: Record<string, any>, schema: FormatSchema): string[] {\n  return validateSchema(data, schema, path.dirname(file))\n}","typeGuard":null,"tryCatchPattern":"try {\n  await processor.masterTag(file)\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Invalid import schema in')) {\n    const items = e.message.split('\\n').filter(l => l.trim().startsWith('*'))\n    console.error(`Schema issues in file:\\n${items.join('\\n')}`)\n  } else throw e\n}","preventionTips":["Run the same validateSchema check in CI on all import files before invoking the processor.","Keep document templates in sync with the FormatSchema for your importer version.","Validate YAML indentation and required fields (e.g. title) when authoring cards by hand.","After importer upgrades, batch-validate existing files and migrate changed schema fields."],"tags":["importer","schema-validation","yaml"],"backgroundTag":"schema-validation-failed","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}