{"record":{"id":"9875756fd1ed4661","repo":"BerriAI/litellm","slug":"agent-with-id-agent-id-not-found-in-db","errorCode":null,"errorMessage":"Agent with ID {agent_id} not found in DB.","messagePattern":"Agent with ID (.+?) not found in DB\\.","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/agent_endpoints/endpoints.py","lineNumber":800,"sourceCode":"    ```\n    \"\"\"\n    await check_feature_access_for_user(user_api_key_dict, \"agents\")\n\n    from litellm.proxy.proxy_server import prisma_client\n\n    _check_agent_management_permission(user_api_key_dict)\n\n    if prisma_client is None:\n        raise HTTPException(status_code=500, detail=\"Prisma client not initialized\")\n\n    try:\n        # Check if agent exists\n        existing_agent = await agents_table(prisma_client).find_unique(where={\"agent_id\": agent_id})\n        if existing_agent is not None:\n            existing_agent = dict[str, object](existing_agent)\n\n        if existing_agent is None:\n            raise HTTPException(status_code=404, detail=f\"Agent with ID {agent_id} not found in DB.\")\n\n        await AGENT_REGISTRY.delete_agent_from_db(agent_id=agent_id, prisma_client=prisma_client)\n\n        AGENT_REGISTRY.deregister_agent(agent_name=existing_agent.get(\"agent_name\"))\n\n        return {\"message\": f\"Agent {agent_id} deleted successfully\"}\n    except HTTPException:\n        raise\n    except Exception as e:\n        verbose_proxy_logger.exception(\"Error deleting agent: %s\", e)\n        raise HTTPException(status_code=500, detail=str(e))\n\n\n@router.post(\n    \"/v1/agents/{agent_id}/make_public\",\n    tags=[\"[beta] A2A Agents\"],\n    dependencies=[Depends(user_api_key_auth)],\n    response_model=AgentMakePublicResponse,","sourceCodeStart":782,"sourceCodeEnd":818,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/agent_endpoints/endpoints.py#L782-L818","documentation":"Agent delete/update against the DB found no row for the given agent_id after checking memory and database; the operation cannot proceed and reports the missing ID. A DB-backed existence check, not an auth failure.","triggerScenarios":"Thrown at litellm/proxy/agent_endpoints/endpoints.py:800 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the agent_id exists in the database; list agents first."],"exampleFix":"GET /agents to confirm the ID.","handlingStrategy":"validation","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-14T00:17:10.932Z"}