{"record":{"id":"502086af384019a4","repo":"odysseus-dev/odysseus","slug":"tag-update-failed","errorCode":null,"errorMessage":"Tag update failed","messagePattern":"Tag update failed","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"routes/gallery/gallery_routes.py","lineNumber":1065,"sourceCode":"    # AI-suggested values you never added.\n    @router.post(\"/api/gallery/clear-user-tags\")\n    async def clear_gallery_user_tags(request: Request) -> Dict[str, Any]:\n        user = get_current_user(request)\n        db = SessionLocal()\n        try:\n            q = db.query(GalleryImage).filter(GalleryImage.is_active == True)\n            q = _owner_filter(q, user)\n            cleared = 0\n            for img in q.all():\n                if img.tags:\n                    img.tags = ''\n                    cleared += 1\n            db.commit()\n            return {\"ok\": True, \"cleared\": cleared}\n        except Exception:\n            db.rollback()\n            logger.exception(\"clear_gallery_user_tags: failed\")\n            raise HTTPException(500, \"Tag update failed\")\n        finally:\n            db.close()\n\n    # ---- POST /api/gallery/clear-ai-tags ----\n    # Wipe the `ai_tags` field on every image owned by the current user.\n    # Leaves user `tags` intact. Use when AI-suggested tags like \"dog\" /\n    # \"woman\" have leaked into the gallery and you want them gone.\n    @router.post(\"/api/gallery/clear-ai-tags\")\n    async def clear_gallery_ai_tags(request: Request, image_id: Optional[str] = Query(None)) -> Dict[str, Any]:\n        user = get_current_user(request)\n        db = SessionLocal()\n        try:\n            q = db.query(GalleryImage).filter(GalleryImage.is_active == True)\n            q = _owner_filter(q, user)\n            if image_id:  # clear just one photo's AI tags\n                q = q.filter(GalleryImage.id == image_id)\n            cleared = 0\n            for img in q.all():","sourceCodeStart":1047,"sourceCodeEnd":1083,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/gallery/gallery_routes.py#L1047-L1083","documentation":"Error \"Tag update 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 tag update; check server logs if it persists.","Verify the image ids and tag names are valid."],"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-15T22:17:37.221Z"}