{"record":{"id":"ed1076d64e343c4d","repo":"BerriAI/litellm","slug":"agent-with-id-agent-id-not-found","errorCode":null,"errorMessage":"Agent with ID {agent_id} not found","messagePattern":"Agent with ID (.+?) not found","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/agent_endpoints/agent_registry.py","lineNumber":394,"sourceCode":"\n        Get the existing agent from the database and patch it with the new values.\n\n        Args:\n            agent_id: The ID of the agent to patch\n            agent: The new agent values to patch\n            prisma_client: The Prisma client to use\n            updated_by: The user ID of the user who is patching the agent\n\n        Returns:\n            The patched agent\n        \"\"\"\n        try:\n            existing_agent = await AgentsRepository(prisma_client).table.find_unique(where={\"agent_id\": agent_id})\n            if existing_agent is not None:\n                existing_agent = dict(existing_agent)\n\n            if existing_agent is None:\n                raise Exception(f\"Agent with ID {agent_id} not found\")\n\n            augment_agent: Final = {**existing_agent, **agent}\n            update_data: Final[dict[str, Any]] = {}\n            if augment_agent.get(\"agent_name\"):\n                update_data[\"agent_name\"] = augment_agent.get(\"agent_name\")\n            if augment_agent.get(\"litellm_params\"):\n                update_data[\"litellm_params\"] = safe_dumps(augment_agent.get(\"litellm_params\"))\n            if augment_agent.get(\"agent_card_params\"):\n                update_data[\"agent_card_params\"] = safe_dumps(augment_agent.get(\"agent_card_params\"))\n\n            for rate_field in (\n                \"tpm_limit\",\n                \"rpm_limit\",\n                \"session_tpm_limit\",\n                \"session_rpm_limit\",\n            ):\n                if rate_field in agent:\n                    update_data[rate_field] = agent.get(rate_field)","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/agent_endpoints/agent_registry.py#L376-L412","documentation":"Raised in the agent patch flow when AgentsRepository.find_unique for the given agent_id returns None — no database row exists to patch. Because patch semantics merge onto an existing record, a missing agent cannot be patched (use create instead), so the operation aborts before any update data is built.","triggerScenarios":"Thrown at litellm/proxy/agent_endpoints/agent_registry.py:394 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the agent_id exists in the database."],"exampleFix":"List 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-14T05:17:10.506Z"}