{"record":{"id":"42e5a72e9160689d","repo":"odysseus-dev/odysseus","slug":"tag-deduplication-failed","errorCode":null,"errorMessage":"Tag deduplication failed","messagePattern":"Tag deduplication failed","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"routes/gallery/gallery_routes.py","lineNumber":1131,"sourceCode":"                original = [t.strip() for t in (img.tags or '').split(',') if t.strip()]\n                cleaned = []\n                seen = set()\n                for t in original:\n                    k = t.lower()\n                    if k in ai_set or k in seen:\n                        continue\n                    seen.add(k)\n                    cleaned.append(t)\n                if len(cleaned) != len(original):\n                    rows_touched += 1\n                    tags_removed += len(original) - len(cleaned)\n                    img.tags = ', '.join(cleaned)\n            db.commit()\n            return {\"ok\": True, \"rows_touched\": rows_touched, \"tags_removed\": tags_removed}\n        except Exception:\n            db.rollback()\n            logger.exception(\"dedupe_gallery_tags: failed\")\n            raise HTTPException(500, \"Tag deduplication failed\")\n        finally:\n            db.close()\n\n    # ---- DELETE /api/gallery/{image_id} ----\n    @router.delete(\"/api/gallery/{image_id}\")\n    async def delete_gallery_image(request: Request, image_id: str) -> Dict[str, str]:\n        user = get_current_user(request)\n        db = SessionLocal()\n        try:\n            img = db.query(GalleryImage).filter(GalleryImage.id == image_id).first()\n            if not img:\n                raise HTTPException(404, \"Image not found\")\n            if not user or img.owner != user:\n                raise HTTPException(404, \"Image not found\")\n\n            img_filename = img.filename\n            # Soft-delete the record first; the DB is the source of truth.\n            img.is_active = False","sourceCodeStart":1113,"sourceCodeEnd":1149,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/gallery/gallery_routes.py#L1113-L1149","documentation":"Error \"Tag deduplication failed\" thrown in odysseus-dev/odysseus.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","solutions":["Retry the deduplication; check server logs for the database error.","Run the operation again after other tag edits settle."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}