diff --git a/backend/src/main/java/org/raddatz/familienarchiv/tag/TagService.java b/backend/src/main/java/org/raddatz/familienarchiv/tag/TagService.java index 23bb2cb5..e6a5dfa8 100644 --- a/backend/src/main/java/org/raddatz/familienarchiv/tag/TagService.java +++ b/backend/src/main/java/org/raddatz/familienarchiv/tag/TagService.java @@ -220,6 +220,11 @@ public class TagService { if (ancestor != null && ancestor.getParentId() == null) return ancestor; } } + // No null-parent ancestor surfaced — the parent is orphaned or the chain is deeper than the + // findAncestorIds CTE's depth guard. Fall back to the tag as its own root, but surface it: + // a silently mislabeled root would otherwise be invisible. UUIDs only (no tag names logged). + log.warn("Tag {} has parent {} but no root surfaced from its ancestry; " + + "treating it as its own root.", tag.getId(), tag.getParentId()); return tag; }