{"record":{"id":"17cbd5ccfd295601","repo":"Significant-Gravitas/AutoGPT","slug":"graph-graph-id-not-found-17cbd5","errorCode":null,"errorMessage":"Graph #{graph_id} not found","messagePattern":"Graph #(.+?) not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"autogpt_platform/backend/backend/api/features/v1.py","lineNumber":1805,"sourceCode":"\n@v1_router.put(\n    path=\"/graphs/{graph_id}\",\n    summary=\"Update graph version\",\n    tags=[\"graphs\"],\n    dependencies=[Security(requires_user)],\n)\nasync def update_graph(\n    graph_id: str,\n    graph: graph_db.Graph,\n    user_id: Annotated[str, Security(get_user_id)],\n    ctx: Annotated[RequestContext, Security(get_request_context)],\n) -> UpdateGraphResponse:\n    if graph.id and graph.id != graph_id:\n        raise HTTPException(400, detail=\"Graph ID does not match ID in URI\")\n\n    existing_versions = await graph_db.get_graph_all_versions(graph_id, user_id=user_id)\n    if not existing_versions:\n        raise HTTPException(404, detail=f\"Graph #{graph_id} not found\")\n\n    graph.version = max(g.version for g in existing_versions) + 1\n    current_active_version = next((v for v in existing_versions if v.is_active), None)\n\n    graph = graph_db.make_graph_model(graph, user_id)\n    graph.reassign_ids(user_id=user_id, reassign_graph_id=False)\n    graph.validate_graph(for_run=False)\n\n    # If this new version is going to be active, validate node credentials\n    # BEFORE persisting so a credential issue can't leave a half-saved version\n    # behind. before_graph_activate may also clear stale optional credentials —\n    # those edits must be persisted, hence the pre-save call.\n    if graph.is_active:\n        graph = await before_graph_activate(graph, user_id=user_id)\n\n    new_graph_version = await graph_db.create_graph(\n        graph,\n        user_id=user_id,","sourceCodeStart":1787,"sourceCodeEnd":1823,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/v1.py#L1787-L1823","documentation":"Raised (404) by PUT /graphs/{graph_id} when graph_db.get_graph_all_versions for the URI graph_id returns nothing for the requesting user. The update proceeds only after confirming at least one existing version the user owns; otherwise the target of the update does not exist in their scope. Note this lookup does not pass organization_id, unlike other endpoints.","triggerScenarios":"Updating a graph that was deleted (e.g. in another tab/session), a mistyped ID, or a graph owned by a different user.","commonSituations":"Concurrent editing sessions where one deletes the graph; stale builder state after a workspace reset; cross-org access attempts.","solutions":["Verify the graph still exists (GET /graphs) and re-create it if it was deleted.","Reload the builder from the graph list instead of a stale URL to resync state.","Confirm the authenticated user is the graph owner."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const versions = await api.getGraphVersions(graphId).catch(() => null);\nif (!versions) { offerRecreate(); return; }","typeGuard":null,"tryCatchPattern":"catch (e) { if (e.response?.status === 404) { alert('This agent was deleted elsewhere.'); window.location.reload(); } else throw e; }","preventionTips":["Guard save/autosave with a 404 branch that stops autosave — retrying updates against a deleted graph just spams errors.","Use server push or refetch-on-focus to learn about concurrent deletes quickly.","Confirm ownership before showing edit affordances for shared graphs."],"tags":["api","graphs","http-404","not-found","concurrency"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}