odysseus-dev/odysseus · error · HTTPException

Failed to delete file

Error message

Failed to delete file: {str(e)}

What it means

A 500 wrap-up in the file-delete path (raised while handling the upload/management request): a non-HTTPException error escaped while removing the file from the index or disk (excluding FileNotFoundError, which is tolerated as a race), and is converted to 'Failed to delete file' with the exception text.

Solutions

  1. Check server logs for the file deletion error.
  2. Verify the file exists and the storage is writable, then retry.
Defensive patterns

Strategy: try-catch

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

Appendix: source

Thrown at routes/personal_routes.py:392

                in_uploads = False
            if in_uploads and abs_target != base_abs:
                try:
                    os.remove(abs_target)
                    deleted_from_disk = True
                except FileNotFoundError:
                    pass  # already gone — race with another request or cleanup

            # Exclude the file from the listing (persists across restarts)
            personal_docs_manager.exclude_file(filepath)

            return {
                "success": True,
                "removed_chunks": removed,
                "deleted_from_disk": deleted_from_disk,
            }
        except Exception as e:
            logger.error(f"Failed to delete file {filepath}: {e}")
            raise HTTPException(500, f"Failed to delete file: {str(e)}")

    return router

View on GitHub (pinned to f9235ebbf1)