odysseus-dev/odysseus · error · HTTPException

Upload cleanup aborted because upload index integrity could…

Error message

Upload cleanup aborted because upload index integrity could not be verified

What it means

503 from manual_cleanup: _run_reference_safe_cleanup raised UploadCleanupSafetyError — the upload index integrity checks failed — so deletion is deliberately aborted rather than risk removing referenced files.

Solutions

  1. Investigate the upload index inconsistency before rerunning cleanup.
  2. Restore the upload index from backup, then retry the cleanup.
Defensive patterns

Strategy: validation

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/64ddaaab93605ced. Report an issue: GitHub.

Appendix: source

Thrown at routes/upload_routes.py:331

                continue
        
        if not out:
            raise HTTPException(500, "All file uploads failed")
            
        return {"files": out}
    
    @router.post("/cleanup")
    async def manual_cleanup(request: Request):
        """Manually trigger cleanup of old uploads."""
        require_admin(request)
        try:
            cleaned_count = await asyncio.to_thread(
                _run_reference_safe_cleanup,
                upload_handler,
            )
        except UploadCleanupSafetyError:
            logger.exception("Upload cleanup aborted because index safety checks failed")
            raise HTTPException(
                503,
                "Upload cleanup aborted because upload index integrity could not be verified",
            )
        except Exception:
            logger.exception("Upload cleanup skipped because reference discovery failed")
            raise HTTPException(
                503,
                "Upload cleanup skipped because persisted references could not be verified",
            )
        return {"status": "success", "files_cleaned": cleaned_count}

    @router.get("/stats")
    async def upload_stats(request: Request):
        """Get statistics about uploaded files."""
        require_admin(request)
        try:
            return upload_handler.get_upload_stats()
        except Exception as e:

View on GitHub (pinned to f9235ebbf1)