odysseus-dev/odysseus · error · HTTPException

File not found

Error message

File not found

What it means

Error "File not found" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/email_routes.py:4058

            return {"success": False, "error": "Mail operation failed"}

    def _safe_compose_filename(name: str, fallback: str = "attachment") -> str:
        safe_name = re.sub(r"[^\w\s\-.]", "_", Path(str(name or fallback)).name).strip(". ")[:180]
        return safe_name or fallback

    def _stage_compose_bytes(filename: str, content: bytes) -> dict:
        if len(content) > EMAIL_COMPOSE_UPLOAD_MAX_BYTES:
            raise HTTPException(status_code=413, detail="Attachment too large")
        safe_name = _safe_compose_filename(filename)
        token = f"{uuid.uuid4().hex}_{safe_name}"
        filepath = COMPOSE_UPLOADS_DIR / token
        with open(filepath, "wb") as f:
            f.write(content)
        return {"success": True, "token": token, "filename": safe_name, "size": len(content)}

    def _stage_compose_file(filename: str, src: Path) -> dict:
        if not src.exists() or not src.is_file():
            raise HTTPException(status_code=404, detail="File not found")
        size = src.stat().st_size
        if size > EMAIL_COMPOSE_UPLOAD_MAX_BYTES:
            raise HTTPException(status_code=413, detail="Attachment too large")
        safe_name = _safe_compose_filename(filename)
        token = f"{uuid.uuid4().hex}_{safe_name}"
        dest = COMPOSE_UPLOADS_DIR / token
        import shutil as _shutil
        _shutil.copyfile(str(src), str(dest))
        return {"success": True, "token": token, "filename": safe_name, "size": size}

    def _load_odysseus_attachment_source(db, kind: str, item_id: str, owner: str):
        from core.database import Document as _Doc, GalleryImage as _GI
        from core.database import Session as _Sess

        if kind == "document":
            doc = db.query(_Doc).filter(_Doc.id == item_id, _Doc.is_active == True).first()
            if not doc:
                raise HTTPException(status_code=404, detail="Document not found")

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Verify the file id is correct and the upload still exists.
  2. Re-upload the file if it was removed, then retry.

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