BerriAI/litellm · error · HTTPException

User {user_api_key_dict.user_id} does not have access to vec

Error message

User {user_api_key_dict.user_id} does not have access to vector store {vector_store_id}

What it means

Access gate for unified vector-store ids: when the id is a base64-encoded LiteLLM unified id, the hook checks can_user_access_unified_resource_id against the calling user/api-key and raises HTTP 403 on denial before any provider traffic. Raw (non-unified) ids fall through and return False instead of raising.

Source

Thrown at enterprise/litellm_enterprise/proxy/hooks/managed_vector_stores.py:290

            True if this is a managed vector store and user has access
            
        Raises:
            HTTPException: If user doesn't have access
        """
        vector_store_id = cast(Optional[str], data.get("vector_store_id"))
        is_unified_id = (
            is_base64_encoded_unified_id(vector_store_id)
            if vector_store_id
            else False
        )
        
        if is_unified_id and vector_store_id:
            if await self.can_user_access_unified_resource_id(
                vector_store_id, user_api_key_dict
            ):
                return True
            else:
                raise HTTPException(
                    status_code=403,
                    detail=f"User {user_api_key_dict.user_id} does not have access to vector store {vector_store_id}",
                )
        
        return False

    # ============================================================================
    #                     PRE-CALL HOOK (For Router Integration)
    # ============================================================================

    async def async_pre_call_hook(
        self,
        user_api_key_dict: UserAPIKeyAuth,
        cache: Any,
        data: Dict,
        call_type: str,
    ) -> Union[Exception, str, Dict, None]:
        """

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a vector store id owned by the caller's team, or create a new one via the managed vector-store endpoint
  2. Ask an admin to grant the user's team access to the store
  3. Verify ownership by listing vector stores as admin before using the id
Defensive patterns

Strategy: validation

Validate before calling

stores = await admin_client.vector_stores.list()  # admin/master key
owned = {s.id for s in stores if my_team_owns(s)}
if vector_store_id not in owned:
    raise PermissionError(f"team does not own {vector_store_id}; request access or create your own")

Try / catch

try:
    result = await search_vector_store(vector_store_id, ...)
except HTTPStatusError as e:
    if e.response.status_code == 403:
        # surface 'request access' UX instead of retrying
        ...
    raise

Prevention

When it happens

Trigger: An enterprise vector-store CRUD or search request referencing a unified vector store id created by a different team/user, made with a virtual key whose team does not own the store.

Common situations: Copying vector store ids between teams or apps without sharing them; personal keys used against team-owned stores; stale ids after a store was recreated under another owner.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/d629c70907c010bc. Report an issue: GitHub.