{"record":{"id":"73ed745584173e3a","repo":"Significant-Gravitas/AutoGPT","slug":"library-agent-not-found-for-graph-created-graph-i","errorCode":null,"errorMessage":"Library agent not found for graph {created_graph.id}","messagePattern":"Library agent not found for graph (.+?)","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/library/db.py","lineNumber":861,"sourceCode":"    graph.version = (\n        max(v.version for v in existing_versions) + 1 if existing_versions else 1\n    )\n\n    graph_model = graph_db.make_graph_model(graph, user_id)\n    graph_model.reassign_ids(user_id=user_id, reassign_graph_id=False)\n\n    # Validate BEFORE persisting so a credential issue can't leave the new\n    # version half-saved. Raises GraphActivationError for the caller.\n    if graph_model.is_active:\n        graph_model = await before_graph_activate(graph_model, user_id=user_id)\n\n    created_graph = await graph_db.create_graph(graph_model, user_id)\n\n    library_agent = await get_library_agent_by_graph_id(\n        user_id, created_graph.id, include_archived=True\n    )\n    if not library_agent:\n        raise NotFoundError(f\"Library agent not found for graph {created_graph.id}\")\n\n    library_agent = await update_library_agent_version_and_settings(\n        user_id, created_graph\n    )\n\n    if created_graph.is_active:\n        await graph_db.set_graph_active_version(\n            graph_id=created_graph.id,\n            version=created_graph.version,\n            user_id=user_id,\n        )\n        if current_active_version:\n            await on_graph_deactivate(current_active_version, user_id=user_id)\n\n        # Migrate webhook-attached presets to the new version so that\n        # existing webhook URLs continue to trigger the latest agent version.\n        # This path is only reached from the CoPilot/AutoPilot agent-update\n        # flow, which has no user-facing channel for skipped-preset warnings,","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/library/db.py#L843-L879","documentation":"Error \"Library agent not found for graph {created_graph.id}\" thrown in Significant-Gravitas/AutoGPT.","triggerScenarios":"Thrown at autogpt_platform/backend/backend/api/features/library/db.py:861 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the operation; the library entry may not have been created yet.","If persistent, re-add the graph to the library."],"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-15T22:17:37.221Z"}