BerriAI/litellm · error · HTTPException
Cannot create a memory entry without a user_id or team_id. A
Error message
Cannot create a memory entry without a user_id or team_id. Authenticate with a key that has a user_id or team_id, or call as a proxy admin.
What it means
HTTPException raised when creating a memory entry would produce an identity-less row: the caller has no user_id/team_id on their key and did not (or cannot, as non-admin) supply either in the body. Such orphan rows would be invisible to every visibility filter, so creation is refused.
Source
Thrown at litellm/proxy/memory/memory_endpoints.py:295
team_id = requested_team_id if requested_team_id is not None else user_api_key_dict.team_id
return user_id, team_id
if requested_user_id is not None and requested_user_id != user_api_key_dict.user_id:
raise HTTPException(
status_code=403,
detail="Only proxy admins may set user_id to a different user.",
)
if requested_team_id is not None and requested_team_id != user_api_key_dict.team_id:
raise HTTPException(
status_code=403,
detail="Only proxy admins may set team_id to a different team.",
)
user_id = user_api_key_dict.user_id
team_id = user_api_key_dict.team_id
if not user_id and not team_id:
# Orphan row: no user_id and no team_id means no non-admin can ever
# see it again via the visibility filter. Reject up front.
raise HTTPException(
status_code=400,
detail=(
"Cannot create a memory entry without a user_id or team_id. "
"Authenticate with a key that has a user_id or team_id, or call "
"as a proxy admin."
),
)
return user_id, team_id
@router.post(
"/v1/memory",
tags=["memory management"],
dependencies=[Depends(user_api_key_auth)],
response_model=LiteLLM_MemoryRow,
)
async def create_memory(
body: MemoryCreateRequest,View on GitHub (pinned to 77b7c6c40c)
Solutions
- Authenticate with a key that has a user_id or team_id, or call as a proxy admin with an explicit scope.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/memory/memory_endpoints.py:295 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/db9d18c8c3ae467b.
Report an issue: GitHub.