{"record":{"id":"d9877ffb123cf42d","repo":"apache/superset","slug":"invalid-object-type-object-type-d9877f","errorCode":null,"errorMessage":"invalid object type {object_type}","messagePattern":"invalid object type (.+?)","errorType":"exception","errorClass":"TaggedObjectDeleteFailedError","httpStatus":500,"severity":"error","filePath":"superset/commands/tag/delete.py","lineNumber":51,"sourceCode":"from superset.tags.models import ObjectType\nfrom superset.utils.decorators import on_error, transaction\nfrom superset.views.base import DeleteMixin\n\nlogger = logging.getLogger(__name__)\n\n\nclass DeleteTaggedObjectCommand(DeleteMixin, BaseCommand):\n    def __init__(self, object_type: ObjectType, object_id: int, tag: str):\n        self._object_type = object_type\n        self._object_id = object_id\n        self._tag = tag\n\n    @transaction(on_error=partial(on_error, reraise=TaggedObjectDeleteFailedError))\n    def run(self) -> None:\n        self.validate()\n        object_type = to_object_type(self._object_type)\n        if object_type is None:\n            raise TaggedObjectDeleteFailedError(\n                f\"invalid object type {self._object_type}\"\n            )\n        TagDAO.delete_tagged_object(object_type, self._object_id, self._tag)\n\n    def validate(self) -> None:\n        exceptions = []\n        # Validate required arguments provided\n        if not (self._object_id and self._object_type):\n            exceptions.append(TaggedObjectDeleteFailedError())\n        # Validate tagged object exists\n        tag = TagDAO.find_by_name(self._tag)\n        if not tag:\n            exceptions.append(\n                TaggedObjectDeleteFailedError(f\"could not find tag: {self._tag}\")\n            )\n        else:\n            # Validate object type\n            object_type = to_object_type(self._object_type)","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/tag/delete.py#L33-L69","documentation":"DeleteTaggedObjectCommand.run() converts object_type with to_object_type(); if it maps to None it raises TaggedObjectDeleteFailedError(f'invalid object type {self._object_type}') (delete.py:51). As with creation, the same check runs in validate(), so hitting it in run() indicates an unrecognized type value reached execution.","triggerScenarios":"DELETE of a tagged object (removing one tag from one object) with an object_type string outside the supported vocabulary — bad API payload, version skew, or scripted call with a typo.","commonSituations":"Automation deleting tags with hard-coded type names that drift across Superset versions; frontend/backend version mismatch introducing a new type the backend can't map.","solutions":["Use a supported object_type value (see the tag API schema for your version)","Validate the type string before issuing the DELETE; log and skip unknown types in batch scripts","Upgrade the lagging component so both sides share the same ObjectType vocabulary"],"exampleFix":"# before\nDELETE /api/v1/tag/0/ tagged with {\"object_type\": \"dash\", \"object_id\": 1, \"tag\": \"k\"}\n# after\n{\"object_type\": \"dashboard\", \"object_id\": 1, \"tag\": \"k\"}","handlingStrategy":"type-guard","validationCode":"def valid_object_type(t: str) -> bool:\n    return to_object_type(t) is not None","typeGuard":"def is_known_object_type(value: str) -> bool:\n    return to_object_type(value) is not None","tryCatchPattern":"try:\n    DeleteTaggedObjectCommand(object_type, object_id, tag).run()\nexcept TaggedObjectDeleteFailedError as ex:\n    if 'invalid object type' in str(ex):\n        correct_type_and_retry()","preventionTips":["Use the tag API schema as the source of truth for object_type values","Keep automation scripts' type constants in sync with your Superset version","Validate before delete; unknown types indicate version drift, fix the caller"],"tags":["tags","api","validation"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}