apache/superset · warning · NoResultFound

Tag with name {tag_name} does not exist.

Error message

Tag with name {tag_name} does not exist.

What it means

Raised by TagDAO.delete_tagged_object when no Tag row exists with the given name (after .strip()). It is a sqlalchemy-style NoResultFound wrapped Superset exception surfacing as 'Tag with name {tag_name} does not exist.' Delete-tagged-object first resolves the tag by name, then locates the TaggedObject join row; failure at the first step produces this error before any object lookup happens.

Source

Thrown at superset/daos/tag.py:81

            )

            if not existing_tagged_object:
                tagged_objects.append(
                    TaggedObject(object_id=object_id, object_type=object_type, tag=tag)
                )

        db.session.add_all(tagged_objects)

    @staticmethod
    def delete_tagged_object(
        object_type: ObjectType, object_id: int, tag_name: str
    ) -> None:
        """
        deletes a tagged object by the object_id, object_type, and tag_name
        """
        tag = TagDAO.find_by_name(tag_name.strip())
        if not tag:
            raise NoResultFound(message=f"Tag with name {tag_name} does not exist.")

        tagged_object = db.session.query(TaggedObject).filter(
            TaggedObject.tag_id == tag.id,
            TaggedObject.object_type == object_type,
            TaggedObject.object_id == object_id,
        )
        if not tagged_object:
            raise NoResultFound(
                message=f'Tagged object with object_id: {object_id} \
                    object_type: {object_type} \
                    and tag name: "{tag_name}" could not be found'
            )

        db.session.delete(tagged_object.one())

    @staticmethod
    def delete_tags(tag_names: list[str]) -> None:
        """

View on GitHub (pinned to f4587218dd)

Solutions

  1. Verify the tag exists first with TagDAO.find_by_name(tag_name.strip()) before deleting.
  2. Refresh the tag list in the UI/script before issuing deletes to avoid stale names.
  3. Treat this error as idempotent-success if the goal is 'make sure it is gone'.
  4. Use the exact canonical spelling of the tag (names are case-sensitive).

Example fix

# before
TagDAO.delete_tagged_object(object_type, object_id, 'Q3-KPIs')  # tag removed earlier -> NoResultFound

# after
from superset.daos.tag import TagDAO
if TagDAO.find_by_name('Q3-KPIs'.strip()):
    TagDAO.delete_tagged_object(object_type, object_id, 'Q3-KPIs')
# else: nothing to do — already gone
Defensive patterns

Strategy: validation

Validate before calling

from superset.daos.tag import TagDAO

def tag_exists(name: str) -> bool:
    return TagDAO.find_by_name(name.strip()) is not None

Try / catch

from superset.commands.tag.exceptions import TagNotFoundError
from sqlalchemy.orm.exc import NoResultFound
try:
    TagDAO.delete_tagged_object(object_type, object_id, tag_name)
except NoResultFound:
    pass  # tag already gone — treat as success

Prevention

When it happens

Trigger: DELETE on the tag-object API with a tag name that was already deleted or never existed; case-mismatched tag names ('Dashboard Of The Month' vs 'dashboard of the month'); leading/trailing whitespace already stripped by the DAO but internal spelling differences remaining.

Common situations: Race between two users removing the same tag; UI showing a stale tag list after another client deleted the tag; scripts replaying recorded tag names against a refreshed environment.

Related errors


AI-assisted analysis of apache/superset@f4587218dd (2026-08-14). Data as JSON: /api/errors/0116875d3ded82d5. Report an issue: GitHub.