{"record":{"id":"4cd2fe510fa2a6bb","repo":"apache/superset","slug":"dataset-folders-are-not-enabled","errorCode":null,"errorMessage":"Dataset folders are not enabled","messagePattern":"Dataset folders are not enabled","errorType":"validation","errorClass":"ValidationError","httpStatus":422,"severity":"warning","filePath":"superset/commands/dataset/update.py","lineNumber":442,"sourceCode":"            for name, count in Counter([item[key] for item in data]).items()\n            if count > 1\n        ]\n        return duplicates\n\n\ndef validate_folders(  # noqa: C901\n    folders: list[FolderSchema],\n    valid_uuids: set[UUID],\n) -> None:\n    \"\"\"\n    Additional folder validation.\n\n    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])","sourceCodeStart":424,"sourceCodeEnd":460,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/dataset/update.py#L424-L460","documentation":"ValidationError('Dataset folders are not enabled') is raised by validate_folders() when the payload contains a folder structure but the DATASET_FOLDERS feature flag is off. The folder schema itself may parse, but business validation gates the feature behind is_feature_enabled('DATASET_FOLDERS').","triggerScenarios":"PUT /api/v1/dataset/{id} (or create) with a 'folders' key in the payload while FEATURE_FLAGS in superset_config.py does not enable DATASET_FOLDERS. Typical when importing/exporting from an instance where the flag was on.","commonSituations":"Configuration drift: YAML/code imports from a preview environment into production where the flag was never enabled. Upgrading Superset versions where DATASET_FOLDERS ships dark by default. Typo in the feature-flag name in superset_config.py.","solutions":["Enable the flag: FEATURE_FLAGS = { ... 'DATASET_FOLDERS': True } in superset_config.py and restart the webserver/workers.","Or strip the 'folders' key from the payload if the feature is not wanted.","Verify the flag at runtime via /api/v1/feature_flags or superset config dump before sending folder data."],"exampleFix":"# before (superset_config.py)\nFEATURE_FLAGS = {\"ALERT_REPORTS\": True}\nPUT /api/v1/dataset/42  body: {\"folders\": [...]}  # 422 Dataset folders are not enabled\n\n# after\nFEATURE_FLAGS = {\"ALERT_REPORTS\": True, \"DATASET_FOLDERS\": True}","handlingStrategy":"validation","validationCode":"from superset.utils.feature_flag_manager import is_feature_enabled  # or superset.config check\n\nif \"folders\" in payload and not is_feature_enabled(\"DATASET_FOLDERS\"):\n    payload.pop(\"folders\")  # or abort with a config error","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Sync FEATURE_FLAGS across environments when importing dataset YAML.","Check /api/v1/feature_flags before sending folder structures.","Treat 'Dataset folders are not enabled' as a config signal, not a data error."],"tags":["feature-flag","dataset","folders","configuration"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}