{"record":{"id":"feeebeeba166c59f","repo":"apache/superset","slug":"unknown-type-sl-type","errorCode":null,"errorMessage":"Unknown type: {sl_type}","messagePattern":"Unknown type: (.+?)","errorType":"validation","errorClass":"SemanticLayerInvalidError","httpStatus":422,"severity":"error","filePath":"superset/commands/semantic_layer/create.py","lineNumber":63,"sourceCode":"    @transaction(\n        on_error=partial(\n            on_error,\n            catches=(SQLAlchemyError, ValueError),\n            reraise=SemanticLayerCreateFailedError,\n        )\n    )\n    def run(self) -> Model:\n        self.validate()\n        if isinstance(self._properties.get(\"configuration\"), dict):\n            self._properties[\"configuration\"] = json.dumps(\n                self._properties[\"configuration\"]\n            )\n        return SemanticLayerDAO.create(attributes=self._properties)\n\n    def validate(self) -> None:\n        sl_type = self._properties.get(\"type\")\n        if sl_type not in registry:\n            raise SemanticLayerInvalidError(f\"Unknown type: {sl_type}\")\n\n        name: str = self._properties.get(\"name\", \"\")\n        if not SemanticLayerDAO.validate_uniqueness(name):\n            raise SemanticLayerInvalidError(f\"Name already exists: {name}\")\n\n        # Validate configuration against the plugin\n        cls = registry[sl_type]\n        cls.from_configuration(self._properties[\"configuration\"])\n\n\nclass CreateSemanticViewCommand(BaseCommand):\n    def __init__(self, data: dict[str, Any]):\n        self._properties = data.copy()\n\n    @transaction(\n        on_error=partial(\n            on_error,\n            catches=(SQLAlchemyError, ValueError),","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/semantic_layer/create.py#L45-L81","documentation":"SemanticLayerInvalidError('Unknown type: ...') raised by CreateSemanticLayerCommand.validate when the 'type' property is not a key in the chart/viz registry — Superset does not know a semantic-layer plugin by that name, so no configuration class exists to validate against.","triggerScenarios":"POST creating a semantic layer with type set to a string that is not registered (typo like 'dbrd_cross_flow' misspelled, a plugin that failed to load, or a custom type never added to the registry).","commonSituations":"Custom visualization plugin not installed or its register call failing silently; version drift where a type was renamed/removed; API payloads copied from a different Superset deployment.","solutions":["Check available types by listing registry keys (e.g. via /api/v1/chart/ or the viz registry) and correct the type string","If a custom plugin provides the type, verify it is installed and its entry point loads without errors","Upgrade/align the deployment so the expected type exists in this instance"],"exampleFix":"# before\npayload = {'name': 'sl', 'type': 'semantic_dashbord', 'configuration': {...}}\n\n# after\nfrom superset.charts.data.api import ChartDataAPI  # or list registry keys\nknown = set(superset.viz.registry.keys())\nassert payload['type'] in known, f'use one of {sorted(known)}'","handlingStrategy":"validation","validationCode":"from superset import viz\nassert payload['type'] in viz.registry, f\"unknown type; known: {sorted(viz.registry)}\"","typeGuard":"def semantic_layer_type_is_registered(sl_type: str) -> bool:\n    from superset import viz\n    return sl_type in viz.registry","tryCatchPattern":"from superset.commands.semantic_layer.exceptions import SemanticLayerInvalidError\ntry:\n    CreateSemanticLayerCommand(props).run()\nexcept SemanticLayerInvalidError as e:\n    if str(e).startswith('Unknown type'):\n        props['type'] = pick_registered_type(); CreateSemanticLayerCommand(props).run()\n    else:\n        raise","preventionTips":["Validate 'type' against the live registry before POST","Verify custom viz plugins are installed and import cleanly","Re-check types after Superset upgrades (registry membership changes)"],"tags":["semantic-layer","plugin-registry","validation","type-error"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}