odysseus-dev/odysseus · error · HTTPException

Tag deduplication failed

Error message

Tag deduplication failed

What it means

Error "Tag deduplication failed" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/gallery/gallery_routes.py:1131

                original = [t.strip() for t in (img.tags or '').split(',') if t.strip()]
                cleaned = []
                seen = set()
                for t in original:
                    k = t.lower()
                    if k in ai_set or k in seen:
                        continue
                    seen.add(k)
                    cleaned.append(t)
                if len(cleaned) != len(original):
                    rows_touched += 1
                    tags_removed += len(original) - len(cleaned)
                    img.tags = ', '.join(cleaned)
            db.commit()
            return {"ok": True, "rows_touched": rows_touched, "tags_removed": tags_removed}
        except Exception:
            db.rollback()
            logger.exception("dedupe_gallery_tags: failed")
            raise HTTPException(500, "Tag deduplication failed")
        finally:
            db.close()

    # ---- DELETE /api/gallery/{image_id} ----
    @router.delete("/api/gallery/{image_id}")
    async def delete_gallery_image(request: Request, image_id: str) -> Dict[str, str]:
        user = get_current_user(request)
        db = SessionLocal()
        try:
            img = db.query(GalleryImage).filter(GalleryImage.id == image_id).first()
            if not img:
                raise HTTPException(404, "Image not found")
            if not user or img.owner != user:
                raise HTTPException(404, "Image not found")

            img_filename = img.filename
            # Soft-delete the record first; the DB is the source of truth.
            img.is_active = False

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Retry the deduplication; check server logs for the database error.
  2. Run the operation again after other tag edits settle.

When it happens

Trigger: Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.

Common situations: See trigger scenarios.


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/42e5a72e9160689d. Report an issue: GitHub.