odysseus-dev/odysseus · error · HTTPException

Session {session_id} not found

Error message

Session {session_id} not found

What it means

Error "Session {session_id} not found" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/session_routes.py:116

    """Verify the current user owns the session, honoring single-user modes.

    Authenticated requests must match the stored DB or in-memory owner. When
    auth is disabled and no user is present, treat the app as single-user mode:
    verify that the session exists, but do not compare its stored owner. This
    keeps QA/dev instances with AUTH_ENABLED=false from rejecting owner-stamped
    rows created while auth was previously enabled.
    """
    user = effective_user(request)
    if not user and not _auth_disabled():
        raise HTTPException(401, "Authentication required")
    db = SessionLocal()
    try:
        row = db.query(DbSession.owner).filter(DbSession.id == session_id).first()
    finally:
        db.close()
    if row is not None:
        if user and row.owner != user:
            raise HTTPException(404, f"Session {session_id} not found")
        return
    # No DB row — allow the caller to act on an in-memory ghost they own.
    if session_manager is not None:
        ghost = getattr(session_manager, "sessions", {}).get(session_id)
        if ghost is not None and (not user or getattr(ghost, "owner", None) == user):
            return
    raise HTTPException(404, f"Session {session_id} not found")

logger = logging.getLogger(__name__)

router = APIRouter(prefix="/api", tags=["sessions"])

def _current_user_is_admin(request: Request, user: str | None) -> bool:
    if not user:
        return False
    auth_mgr = getattr(request.app.state, "auth_manager", None)
    is_admin = getattr(auth_mgr, "is_admin", None)
    if not callable(is_admin):

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Verify the session id is correct and the session exists.
  2. Refresh the session list and pick an existing session.

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