unslothai/unsloth · error · HTTPException

Could not read the gallery's pin/archive data, so clearing w

Error message

Could not read the gallery's pin/archive data, so clearing was stopped to avoid deleting archived videos.

What it means

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.

Source

Thrown at studio/backend/routes/video.py:626

    deleted = await asyncio.to_thread(video_gallery.delete, video_id)
    if not deleted:
        raise HTTPException(status_code = 404, detail = "Video not found.")
    _forget_terminal_video(video_id)
    return {"deleted": True}


@router.delete("/video/gallery")
async def clear_gallery_videos(current_subject: str = Depends(get_current_subject)):
    from core.inference import video_gallery
    from core.inference.gallery_flags import FlagsUnavailable

    try:
        removed = await asyncio.to_thread(video_gallery.clear)
    except FlagsUnavailable as exc:
        # Refuse rather than delete the archive we cannot prove is archived.
        logger.warning("video_gallery.clear_blocked: %s", exc)
        raise HTTPException(
            status_code = 503,
            detail = "Could not read the gallery's pin/archive data, so clearing was stopped to "
            "avoid deleting archived videos.",
        )
    # Clear-all takes the terminal record's clip with it whatever its id.
    _forget_terminal_video(None)
    return {"removed": removed}

View on GitHub (pinned to 203007d190)

Solutions

  1. Check the 'video_gallery.clear_blocked' warning in the server log for the underlying cause.
  2. Repair permissions/ownership on the gallery flags storage (chown/chmod) or restore the missing flags file.
  3. 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.

Example fix

# diagnose + fix
$ chown -R $(whoami) ~/.unsloth/studio
$ ls -la ~/.unsloth/studio/video-gallery/  # flags file present/readable?
# then retry: DELETE /api/inference/video/gallery
Defensive patterns

Strategy: try-catch

Try / catch

try { await api.del('/video/gallery'); }
catch (e) {
  if (e?.status === 503) toast('Clear-all is blocked: the pin/archive data is unreadable. Nothing was deleted.');
  else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Gallery data directory partially deleted or restored from backup without the flags file; permission change after running under a different user; disk corruption.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/8d4905ec682d76cb. Report an issue: GitHub.