odysseus-dev/odysseus · error · HTTPException

Unsupported cleanup action

Error message

Unsupported cleanup action

What it means

Validation guard in the POST /unsubscribe/cleanup handler: the action value in the request body is not one of the supported review dispositions (move to Junk or Trash). It is a sentinel rejection of an unknown/unsupported cleanup action string, preventing arbitrary or malformed actions from mutating mailbox folders.

Solutions

  1. Use one of the supported cleanup actions listed in the email cleanup UI.
  2. Check the request payload for a typo in the action name.
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/4af5037338a76e51. Report an issue: GitHub.

Appendix: source

Thrown at routes/email_routes.py:2685

                "method": method,
                "candidate": candidate,
                "moved_to_spam": moved,
            }
        except ValueError as e:
            return {"success": False, "error": str(e)}
        except Exception as e:
            logger.error(f"unsubscribe execute failed uid={uid}: {e}")
            return {"success": False, "error": "Mail operation failed"}

    @router.post("/unsubscribe/cleanup")
    def cleanup_unsubscribe_candidates(data: dict, owner: str = Depends(require_owner)):
        """Move reviewed unsubscribe candidate messages to Junk or Trash."""
        folder = str((data or {}).get("folder") or "INBOX").strip() or "INBOX"
        account_id = (data or {}).get("account_id") or None
        action = str((data or {}).get("action") or "").strip().lower()
        raw_uids = (data or {}).get("uids") or []
        if action not in {"junk", "delete"}:
            raise HTTPException(400, "Unsupported cleanup action")
        if account_id:
            _assert_owns_account(account_id, owner)
        uids: list[str] = []
        seen = set()
        for raw_uid in raw_uids:
            uid = str(raw_uid or "").strip()
            if not uid or uid in seen:
                continue
            if not uid.isdigit():
                continue
            seen.add(uid)
            uids.append(uid)
        if not uids:
            return {"success": False, "error": "No email UIDs provided", "changed": 0, "failed": 0}
        role = "junk" if action == "junk" else "trash"
        target = "Junk" if action == "junk" else "Trash"
        changed = 0
        failed = 0

View on GitHub (pinned to f9235ebbf1)