{"record":{"id":"b4725bd2b8369b8e","repo":"apache/superset","slug":"duplicate-uuid-in-folder-structure-uuid","errorCode":null,"errorMessage":"Duplicate UUID in folder structure: {uuid}","messagePattern":"Duplicate UUID in folder structure: (.+?)","errorType":"validation","errorClass":"ValidationError","httpStatus":422,"severity":"error","filePath":"superset/commands/dataset/update.py","lineNumber":455,"sourceCode":"    The marshmallow schema will validate the folder structure, but we still need to\n    check that UUIDs are valid, names are unique and not reserved, and that there are\n    no cycles.\n    \"\"\"\n    if not is_feature_enabled(\"DATASET_FOLDERS\"):\n        raise ValidationError(\"Dataset folders are not enabled\")\n\n    queue: list[tuple[FolderSchema, list[UUID]]] = [(folder, []) for folder in folders]\n    seen_uuids = set()\n    seen_fqns = set()  # fully qualified folder names\n    while queue:\n        obj, path = queue.pop(0)\n        uuid, name = obj[\"uuid\"], obj.get(\"name\")\n\n        if uuid in path:\n            raise ValidationError(f\"Cycle detected: {uuid} appears in its ancestry\")\n\n        if uuid in seen_uuids:\n            raise ValidationError(f\"Duplicate UUID in folder structure: {uuid}\")\n        seen_uuids.add(uuid)\n\n        # folders can have duplicate name as long as they're not siblings\n        if name:\n            fqn = tuple(path + [name])\n            if name and fqn in seen_fqns:\n                raise ValidationError(f\"Duplicate folder name: {name}\")\n            seen_fqns.add(fqn)\n\n            # Allow default folders (by UUID) to use reserved names\n            if (\n                name.lower() in {\"metrics\", \"columns\"}\n                and str(uuid) not in DEFAULT_FOLDER_UUIDS\n            ):\n                raise ValidationError(f\"Folder cannot have name '{name}'\")\n\n        # check if metric/column UUID exists (skip default folders)\n        elif (","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/dataset/update.py#L437-L473","documentation":"Raised by validate_folders() when the same folder uuid appears more than once in the submitted structure. seen_uuids tracks every visited node; a repeat means one folder object was pasted/duplicated or referenced in two places.","triggerScenarios":"PUT /api/v1/dataset/{id} with a folders array containing two nodes sharing a uuid (e.g. the same subfolder attached under two different parents, or a copy-paste duplication).","commonSituations":"Copy-pasting a folder block in the JSON payload and forgetting to regenerate the uuid. Merging folder trees from two datasets that both contain a shared subfolder id.","solutions":["Find the duplicated uuid named in the message and either remove one occurrence or assign a fresh uuid to the copy.","If the same logical folder must appear once, keep a single node — folders are a tree, not a DAG.","Dedupe programmatically before submit (see validationCode)."],"exampleFix":"# before\n[{uuid: U1, children: []}, {uuid: U1, name: \"dup\", children: []}]\n# after\n[{uuid: U1, children: []}, {uuid: str(uuid4()), name: \"dup\", children: []}]","handlingStrategy":"validation","validationCode":"uuids = [f[\"uuid\"] for f in walk(folders)]\nassert len(uuids) == len(set(uuids)), f\"duplicates: {find_dups(uuids)}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate a fresh uuid for every cloned folder node.","Remember folders form a tree, not a DAG — no shared subtrees.","Dedupe before resubmitting imported trees."],"tags":["dataset","folders","validation","uuid"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}