{"record":{"id":"a2d3683e869de41d","repo":"BerriAI/litellm","slug":"provide-either-team-id-or-key-hash-not-both","errorCode":null,"errorMessage":"Provide either team_id or key_hash, not both","messagePattern":"Provide either team_id or key_hash, not both","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/tool_management_endpoints.py","lineNumber":621,"sourceCode":"    - key_hash: optional - if set, create/update override for this key only\n    \"\"\"\n    from litellm.proxy.db.tool_registry_writer import (\n        add_tool_to_object_permission_blocked,\n        get_tool_policy_registry,\n        remove_tool_from_object_permission_blocked,\n    )\n    from litellm.proxy.db.tool_registry_writer import (\n        update_tool_policy as db_update_tool_policy,\n    )\n    from litellm.proxy.proxy_server import prisma_client\n\n    if prisma_client is None:\n        raise HTTPException(status_code=500, detail=CommonProxyErrors.db_not_connected_error.value)\n\n    try:\n        if data.team_id is not None or data.key_hash is not None:\n            if data.team_id is not None and data.key_hash is not None:\n                raise HTTPException(\n                    status_code=400,\n                    detail=\"Provide either team_id or key_hash, not both\",\n                )\n            if data.key_hash is not None:\n                op_id = await _resolve_key_hash_to_object_permission_id(prisma_client, data.key_hash)\n            else:\n                op_id = await _resolve_team_id_to_object_permission_id(prisma_client, data.team_id or \"\")\n            if op_id is None:\n                raise HTTPException(\n                    status_code=404,\n                    detail=\"Key or team not found for the given identifier\",\n                )\n            is_blocking: Final = data.input_policy == \"blocked\"\n            if is_blocking:\n                ok = await add_tool_to_object_permission_blocked(\n                    prisma_client=prisma_client,\n                    object_permission_id=op_id,\n                    tool_name=data.tool_name,","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/tool_management_endpoints.py#L603-L639","documentation":"Error \"Provide either team_id or key_hash, not both\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/tool_management_endpoints.py:621 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass either team_id or key_hash to scope the override, not both."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}