{"record":{"id":"265d8fb884b3c2b9","repo":"hcengineering/platform","slug":"tag-should-be-inside-master-tag-folder-currentp","errorCode":null,"errorMessage":"Tag should be inside master tag folder: ${currentPath}","messagePattern":"Tag should be inside master tag folder: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/importer/src/huly/cards.ts","lineNumber":153,"sourceCode":"      switch (yamlConfig?.class) {\n        case card.class.MasterTag: {\n          const masterTagId = this.metadataRegistry.getRef(yamlPath) as Ref<MasterTag>\n          const masterTag = await this.createMasterTag(yamlConfig, yamlPath, parentMasterTagId)\n          const masterTagAttributes = await this.createAttributes(yamlPath, yamlConfig, masterTagId)\n\n          this.metadataRegistry.setAttributes(yamlPath, masterTagAttributes)\n          result.docs.set(yamlPath, [masterTag, ...Array.from(masterTagAttributes.values())])\n          types.push(masterTag)\n\n          const masterTagDir = path.join(currentPath, path.basename(yamlPath, '.yaml'))\n          if (fs.existsSync(masterTagDir) && fs.statSync(masterTagDir).isDirectory()) {\n            await this.processMetadata(masterTagDir, result, [], masterTagId)\n          }\n          break\n        }\n        case card.class.Tag: {\n          if (parentMasterTagId === undefined) {\n            throw new Error('Tag should be inside master tag folder: ' + currentPath)\n          }\n          await this.processTag(yamlPath, yamlConfig, result, parentMasterTagId)\n          break\n        }\n        case core.class.Association: {\n          const association = await this.createAssociation(yamlPath, yamlConfig)\n          result.docs.set(yamlPath, [association])\n          break\n        }\n        case core.class.Enum: {\n          const enumDoc = await this.createEnum(yamlPath, yamlConfig)\n          this.metadataRegistry.setEnumValues(yamlPath, yamlConfig.values)\n          result.docs.set(yamlPath, [enumDoc])\n          break\n        }\n        default:\n          this.logger.log('Skipping class: ' + yamlConfig?.class)\n      }","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/huly/cards.ts#L135-L171","documentation":"In the huly card importer, `processMetadata` encounters a YAML config describing a `card.class.Tag` but no master tag folder context (`parentMasterTagId`) is established. Tags in Huly must live under a master tag (type) folder, so the importer refuses to create an orphan tag and throws with the offending path.","triggerScenarios":"Processing a directory tree where a tag YAML file appears outside any master tag folder — the master tag definition is missing, not yet processed (ordering), or the tag file sits in a directory that is not under the master tag directory.","commonSituations":"Exporting/authoring card data where tag files were moved out of their type folder; the master tag YAML is absent or misnamed so `parentMasterTagId` never gets set; directory traversal order processes the tag before its master tag folder.","solutions":["Move the tag YAML file into the master tag folder it belongs to (or restore the master tag definition file)","Ensure the master tag is defined and processed before/in the same run so parentMasterTagId is set","Check directory structure: tags must be nested under the master tag directory the importer expects","Verify the export tool produced the expected folder hierarchy (master tag folder containing its tags)"],"exampleFix":"// before\n// tags/\n//   urgent.yaml        <- tag with no master tag folder above\n// after\n// master-tags/\n//   statuses.yaml      <- master tag (type) definition\n//   tags/\n//     urgent.yaml      <- tag inside master tag folder","handlingStrategy":"validation","validationCode":"// before processing, verify every tag yaml is nested under a master tag folder\nfor (const tagPath of tagFiles) {\n  if (!tagPath.startsWith(masterTagDir)) {\n    console.warn(`tag outside master tag folder: ${tagPath}`)\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await importer.processDirectory(root)\n} catch (err) {\n  const m = /Tag should be inside master tag folder: (.+)/.exec((err as Error).message)\n  if (m) console.error(`move ${m[1]} under its master tag folder`)\n  throw err\n}","preventionTips":["Keep tag YAML files inside their master tag (type) folder","Always include the master tag definition in the import set","Check export tooling preserves the folder hierarchy","Ensure directory traversal order defines the master tag before its tags"],"tags":["import","huly","cards","hierarchy"],"backgroundTag":"referenced-entity-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}