-
-
Notifications
You must be signed in to change notification settings - Fork 418
Labels
Priority: CriticalAn issue that requires immediate attentionAn issue that requires immediate attentionTagStudio: LibraryRelating to the TagStudio library systemRelating to the TagStudio library systemTagStudio: TagsRelating to the TagStudio tag systemRelating to the TagStudio tag systemType: BugSomething isn't working as intendedSomething isn't working as intended
Milestone
Description
Checklist
- I am using an up-to-date version.
- I have read the documentation.
- I have searched existing issues.
TagStudio Version
main branch (Alpha 9.5.4+)
Operating System & Version
macOS 15.6.1
Description
TagParents are not being deleted from the tag_parents
table in the database when deleting a Tag from the tags
table. I came across this error before #1103 was merged but didn't track down the cause until afterwards.
Expected Behavior
When a tag is deleted from the database, all references of that tag should also be removed. This includes any rows in tag_parents
in which that tag's ID was involved in a relationship.
Any current libraries that are affected by this issue also need to be repaired and have these invalid tag_parents deleted.
Steps to Reproduce
- Create tag, example "Parent"
- Create tag, example "Child"
- Add Parent tag to Child's parent tags
- Add Parent tag to an entry
- In the tag manager, delete the "Parent" tag
- Click on the entry to view the traceback in the console, or investigate the DB to see that the tag_parent row is still present
Logs
When viewing an entry that has a tag referencing a deleted parent:
Traceback (most recent call last):
File "/Users/cyanvoxel/Local/Dev/TagStudio/src/tagstudio/qt/views/preview_panel_view.py", line 165, in set_selection
self._fields.update_from_entry(entry_id)
File "/Users/cyanvoxel/Local/Dev/TagStudio/src/tagstudio/qt/mixed/field_containers.py", line 116, in update_from_entry
self.update_granular(entry.tags, entry.fields, update_badges)
File "/Users/cyanvoxel/Local/Dev/TagStudio/src/tagstudio/qt/mixed/field_containers.py", line 126, in update_granular
categories = self.get_tag_categories(entry_tags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cyanvoxel/Local/Dev/TagStudio/src/tagstudio/qt/mixed/field_containers.py", line 173, in get_tag_categories
hierarchy_tags = self.lib.get_tag_hierarchy(t.id for t in tags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cyanvoxel/Local/Dev/TagStudio/src/tagstudio/core/library/alchemy/library.py", line 1608, in get_tag_hierarchy
tag.parent_tags = {all_tags[p] for p in all_tag_parents.get(tag.id, [])}
~~~~~~~~^^^
KeyError: 1000
Metadata
Metadata
Assignees
Labels
Priority: CriticalAn issue that requires immediate attentionAn issue that requires immediate attentionTagStudio: LibraryRelating to the TagStudio library systemRelating to the TagStudio library systemTagStudio: TagsRelating to the TagStudio tag systemRelating to the TagStudio tag systemType: BugSomething isn't working as intendedSomething isn't working as intended
Type
Projects
Status
🛠 Ready for Development