mem0ai/mem0 · error · HTTPException
User not found.
Error message
User not found.
What it means
Error "User not found." thrown in mem0ai/mem0.
Source
Thrown at server/auth.py:122
bearer_scheme = HTTPBearer(auto_error=False)
api_key_header = APIKeyHeader(name="X-API-Key", auto_error=False)
def _mark_auth_type(request: Request, auth_type: str) -> None:
request.state.auth_type = auth_type
def _get_default_user(db: Session) -> User | None:
return db.scalar(select(User).order_by(User.created_at.asc()))
def _resolve_user_from_jwt(token: str, db: Session) -> User:
payload = decode_token(token)
if payload.get("type") != "access":
raise HTTPException(status_code=401, detail="Invalid token type.")
user = db.get(User, payload.get("sub"))
if user is None:
raise HTTPException(status_code=401, detail="User not found.")
return user
def _resolve_user_from_api_key(key: str, db: Session) -> User:
prefix = key[:12] if len(key) >= 12 else key
candidates = (
db.execute(select(APIKey).where(APIKey.key_prefix == prefix, APIKey.revoked_at.is_(None))).scalars().all()
)
for candidate in candidates:
if verify_api_key_hash(key, candidate.key_hash):
candidate.last_used_at = datetime.now(timezone.utc)
db.commit()
user = db.get(User, candidate.created_by)
if user is None:
raise HTTPException(status_code=401, detail="API key owner not found.")
return user
View on GitHub (pinned to 001c235229)
Solutions
- Verify the user still exists; the account may have been deleted. Log in again.
When it happens
Trigger: Thrown at server/auth.py:122 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/76b5ebfd21897027.
Report an issue: GitHub.