{"record":{"id":"8d4905ec682d76cb","repo":"unslothai/unsloth","slug":"could-not-read-the-gallery-s-pin-archive-data-so","errorCode":null,"errorMessage":"Could not read the gallery's pin/archive data, so clearing was stopped to avoid deleting archived videos.","messagePattern":"Could not read the gallery's pin/archive data, so clearing was stopped to avoid deleting archived videos\\.","errorType":"http","errorClass":"HTTPException","httpStatus":503,"severity":"error","filePath":"studio/backend/routes/video.py","lineNumber":626,"sourceCode":"\n    deleted = await asyncio.to_thread(video_gallery.delete, video_id)\n    if not deleted:\n        raise HTTPException(status_code = 404, detail = \"Video not found.\")\n    _forget_terminal_video(video_id)\n    return {\"deleted\": True}\n\n\n@router.delete(\"/video/gallery\")\nasync def clear_gallery_videos(current_subject: str = Depends(get_current_subject)):\n    from core.inference import video_gallery\n    from core.inference.gallery_flags import FlagsUnavailable\n\n    try:\n        removed = await asyncio.to_thread(video_gallery.clear)\n    except FlagsUnavailable as exc:\n        # Refuse rather than delete the archive we cannot prove is archived.\n        logger.warning(\"video_gallery.clear_blocked: %s\", exc)\n        raise HTTPException(\n            status_code = 503,\n            detail = \"Could not read the gallery's pin/archive data, so clearing was stopped to \"\n            \"avoid deleting archived videos.\",\n        )\n    # Clear-all takes the terminal record's clip with it whatever its id.\n    _forget_terminal_video(None)\n    return {\"removed\": removed}\n","sourceCodeStart":608,"sourceCodeEnd":634,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/routes/video.py#L608-L634","documentation":"503 from DELETE /video/gallery (clear-all): video_gallery.clear raised FlagsUnavailable, meaning the pin/archive metadata could not be read. Since clear() deletes only non-archived clips, unreadable flags make it impossible to prove which clips are archived — the route refuses (503) rather than risk deleting archived videos.","triggerScenarios":"Clear-all while the flags store is missing, corrupt, or unreadable (permissions, moved STUDIO_HOME, damaged flags file); a partially-failed earlier write left the flags store in a bad state.","commonSituations":"Gallery data directory partially deleted or restored from backup without the flags file; permission change after running under a different user; disk corruption.","solutions":["Check the 'video_gallery.clear_blocked' warning in the server log for the underlying cause.","Repair permissions/ownership on the gallery flags storage (chown/chmod) or restore the missing flags file.","Retry clear-all once the flags read succeeds; if the flags file is unrecoverable and you accept deleting everything including archived clips, delete the gallery storage manually with the server stopped."],"exampleFix":"# diagnose + fix\n$ chown -R $(whoami) ~/.unsloth/studio\n$ ls -la ~/.unsloth/studio/video-gallery/  # flags file present/readable?\n# then retry: DELETE /api/inference/video/gallery","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await api.del('/video/gallery'); }\ncatch (e) {\n  if (e?.status === 503) toast('Clear-all is blocked: the pin/archive data is unreadable. Nothing was deleted.');\n  else throw e;\n}","preventionTips":["Show the 503 detail — it explains the refusal protected archived videos","Keep gallery flag storage backed up and readable (permissions, sync tools off)","Fix the flags store first, then retry clear-all; never force-delete around the guard"],"tags":["http-503","fail-safe","flags-unavailable","data-loss-prevention"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}