{"record":{"id":"57eaaab1983d6486","repo":"apache/superset","slug":"tag-parameters-are-invalid","errorCode":null,"errorMessage":"Tag parameters are invalid.","messagePattern":"Tag parameters are invalid\\.","errorType":"validation","errorClass":"TagInvalidError","httpStatus":422,"severity":"error","filePath":"superset/commands/tag/create.py","lineNumber":73,"sourceCode":"\n    def validate(self) -> None:\n        exceptions = []\n        # Validate object_id\n        if self._object_id == 0:\n            exceptions.append(TagCreateFailedError())\n        # Validate object type\n        object_type = to_object_type(self._object_type)\n        if not object_type:\n            exceptions.append(\n                TagCreateFailedError(f\"invalid object type {self._object_type}\")\n            )\n\n        # Validate user has access to the target object\n        if object_type:\n            self._validate_object_access(object_type, self._object_id, exceptions)\n\n        if exceptions:\n            raise TagInvalidError(exceptions=exceptions)\n\n    def _validate_object_access(\n        self, object_type: ObjectType, object_id: int, exceptions: list[Any]\n    ) -> None:\n        \"\"\"Validate that the current user has access to the target object.\"\"\"\n        # Skip base filter so we can distinguish \"not found\" from \"no access\"\n        target_object = to_object_model(object_type, object_id, skip_base_filter=True)\n        if not target_object:\n            # Allow operation on stale references; no object to authorize against\n            return\n\n        try:\n            if object_type == ObjectType.dashboard:\n                security_manager.raise_for_access(dashboard=target_object)\n            elif object_type == ObjectType.chart:\n                security_manager.raise_for_access(chart=target_object)\n            elif object_type == ObjectType.query:\n                security_manager.raise_for_access(query=target_object)","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/tag/create.py#L55-L91","documentation":"CreateCustomTagCommand.validate() accumulates failures (object_id == 0, unmapped object type, object access denied) and, when the list is non-empty, raises TagInvalidError(exceptions=exceptions) (create.py:73). 'Tag parameters are invalid.' is the aggregate message shown when the request parameters fail one or more validation rules.","triggerScenarios":"POST /api/v1/tag/ with object_id=0; object_type not convertible by to_object_type; or the caller lacks permission to modify the target object (surfaced by _validate_object_access).","commonSituations":"Frontend sends a default/zero id for an unsaved object; clients passing arbitrary object_type strings; a user tagging an object they can read but not modify.","solutions":["Inspect the nested exceptions list in the error payload — it itemizes exactly which parameter failed","Supply a valid non-zero object_id and a recognized object_type","If access validation failed, tag an object you own/can modify, or request the needed permission from an admin"],"exampleFix":"# before\n{\"object_type\": \"dashboard\", \"object_id\": 0, \"tags\": [\"important\"]}\n# after\n{\"object_type\": \"dashboard\", \"object_id\": 42, \"tags\": [\"important\"]}","handlingStrategy":"validation","validationCode":"def valid_tag_request(object_type: str, object_id: int) -> bool:\n    return (\n        bool(object_id)\n        and object_id > 0\n        and to_object_type(object_type) is not None\n    )","typeGuard":null,"tryCatchPattern":"try:\n    CreateCustomTagCommand(...).run()\nexcept TagInvalidError as ex:\n    for sub in ex.exceptions:\n        handle_each_validation_failure(sub)","preventionTips":["Always parse the nested exceptions array — it pinpoints the bad parameter","Never send 0 or None ids; guard in the client before POST","Confirm modify permission on the target object before tagging it"],"tags":["tags","api","validation"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}