Significant-Gravitas/AutoGPT · warning · HTTPException

Graph #{graph_id} not found

Error message

Graph #{graph_id} not found

What it means

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.

Source

Thrown at autogpt_platform/backend/backend/api/features/v1.py:1805

@v1_router.put(
    path="/graphs/{graph_id}",
    summary="Update graph version",
    tags=["graphs"],
    dependencies=[Security(requires_user)],
)
async def update_graph(
    graph_id: str,
    graph: graph_db.Graph,
    user_id: Annotated[str, Security(get_user_id)],
    ctx: Annotated[RequestContext, Security(get_request_context)],
) -> UpdateGraphResponse:
    if graph.id and graph.id != graph_id:
        raise HTTPException(400, detail="Graph ID does not match ID in URI")

    existing_versions = await graph_db.get_graph_all_versions(graph_id, user_id=user_id)
    if not existing_versions:
        raise HTTPException(404, detail=f"Graph #{graph_id} not found")

    graph.version = max(g.version for g in existing_versions) + 1
    current_active_version = next((v for v in existing_versions if v.is_active), None)

    graph = graph_db.make_graph_model(graph, user_id)
    graph.reassign_ids(user_id=user_id, reassign_graph_id=False)
    graph.validate_graph(for_run=False)

    # If this new version is going to be active, validate node credentials
    # BEFORE persisting so a credential issue can't leave a half-saved version
    # behind. before_graph_activate may also clear stale optional credentials —
    # those edits must be persisted, hence the pre-save call.
    if graph.is_active:
        graph = await before_graph_activate(graph, user_id=user_id)

    new_graph_version = await graph_db.create_graph(
        graph,
        user_id=user_id,

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Verify the graph still exists (GET /graphs) and re-create it if it was deleted.
  2. Reload the builder from the graph list instead of a stale URL to resync state.
  3. Confirm the authenticated user is the graph owner.
Defensive patterns

Strategy: try-catch

Validate before calling

const versions = await api.getGraphVersions(graphId).catch(() => null);
if (!versions) { offerRecreate(); return; }

Try / catch

catch (e) { if (e.response?.status === 404) { alert('This agent was deleted elsewhere.'); window.location.reload(); } else throw e; }

Prevention

When it happens

Trigger: Updating a graph that was deleted (e.g. in another tab/session), a mistyped ID, or a graph owned by a different user.

Common situations: Concurrent editing sessions where one deletes the graph; stale builder state after a workspace reset; cross-org access attempts.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/17cbd5ccfd295601. Report an issue: GitHub.