{"record":{"id":"135bda0b470b130e","repo":"Significant-Gravitas/AutoGPT","slug":"library-agent-library-agent-id-not-found-135bda","errorCode":null,"errorMessage":"Library agent #{library_agent_id} not found","messagePattern":"Library agent #(.+?) not found","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/library/db.py","lineNumber":1026,"sourceCode":"    if n_updated < 1:\n        raise NotFoundError(f\"Library agent {library_agent_id} not found\")\n\n    return await get_library_agent(\n        id=library_agent_id,\n        user_id=user_id,\n    )\n\n\nasync def delete_library_agent(\n    library_agent_id: str, user_id: str, soft_delete: bool = True\n) -> None:\n    # First get the agent to find the graph_id for cleanup\n    library_agent = await prisma.models.LibraryAgent.prisma().find_unique(\n        where={\"id\": library_agent_id}, include={\"AgentGraph\": True}\n    )\n\n    if not library_agent or library_agent.userId != user_id:\n        raise NotFoundError(f\"Library agent #{library_agent_id} not found\")\n\n    graph_id = library_agent.agentGraphId\n\n    # Clean up everything that drives this agent BEFORE deleting it, so\n    # nothing keeps firing against a half-deleted agent (schedules, webhooks,\n    # and the trigger agents that exist solely to run it).\n    await _cleanup_schedules_for_graph(graph_id=graph_id, user_id=user_id)\n    await _cleanup_webhooks_for_graph(graph_id=graph_id, user_id=user_id)\n    # A trigger agent is a hidden agent whose graph runs this (action) agent\n    # via an AgentExecutorBlock; once the action agent is gone it has no\n    # purpose and is never shown on its own, so it must be cleaned up too.\n    # Skip when deleting a hidden agent — triggers don't have triggers, which\n    # also bounds the recursion at one level.\n    if not library_agent.isHidden:\n        await _cleanup_trigger_agents_for_graph(\n            action_graph_id=graph_id, user_id=user_id, soft_delete=soft_delete\n        )\n","sourceCodeStart":1008,"sourceCodeEnd":1044,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/library/db.py#L1008-L1044","documentation":"Error \"Library agent #{library_agent_id} not found\" thrown in Significant-Gravitas/AutoGPT.","triggerScenarios":"Thrown at autogpt_platform/backend/backend/api/features/library/db.py:1026 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the library agent ID exists and is accessible to your account.","Refresh the library list and retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}