Significant-Gravitas/AutoGPT · warning · HTTPException

Graph #{graph_id} v{new_active_version} not found

Error message

Graph #{graph_id} v{new_active_version} not found

What it means

Raised (404) by POST /graphs/{graph_id}/active_version when graph_db.get_graph(graph_id, active_graph_version, user_id) returns nothing — the specific version number in SetGraphActiveVersion does not exist for this user's graph. Version numbers are per-graph integers; activating a nonexistent one is a client error.

Source

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

@v1_router.put(
    path="/graphs/{graph_id}/versions/active",
    summary="Set active graph version",
    tags=["graphs"],
    dependencies=[Security(requires_user)],
)
async def set_graph_active_version(
    graph_id: str,
    request_body: SetGraphActiveVersion,
    user_id: Annotated[str, Security(get_user_id)],
    ctx: Annotated[RequestContext, Security(get_request_context)],
) -> SetActiveGraphVersionResponse:
    new_active_version = request_body.active_graph_version
    new_active_graph = await graph_db.get_graph(
        graph_id, new_active_version, user_id=user_id
    )
    if not new_active_graph:
        raise HTTPException(404, f"Graph #{graph_id} v{new_active_version} not found")

    current_active_graph = await graph_db.get_graph(
        graph_id=graph_id,
        version=None,
        user_id=user_id,
    )

    # Validate the new graph's credentials before flipping the active version.
    # Capture the returned graph: before_graph_activate may clear stale
    # optional credential references, which we want propagated to the library
    # agent's settings sync below.
    new_active_graph = await before_graph_activate(new_active_graph, user_id=user_id)
    # Ensure new version is the only active version
    await graph_db.set_graph_active_version(
        graph_id=graph_id,
        version=new_active_version,
        user_id=user_id,
    )

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Re-fetch /graphs/{graph_id}/versions and pick a version that actually exists before activating.
  2. In the UI, refresh the version list right before the activate action to shrink the race window.
  3. Handle 404 by prompting the user to reload rather than silently retrying the same number.
Defensive patterns

Strategy: validation

Validate before calling

const versions = await api.getGraphVersions(graphId);
const exists = versions.some(v => v.version === targetVersion);
if (!exists) { refreshVersionPicker(versions); return; }
await api.setActiveVersion(graphId, targetVersion);

Type guard

const versionExists = (n: number, versions: {version: number}[]) => versions.some(v => v.version === n);

Try / catch

catch (e) { if (e.response?.status === 404) { reloadVersionsAndNotifyUser(); } else throw e; }

Prevention

When it happens

Trigger: Posting {"active_graph_version": 7} when the graph only has versions 1-3 — stale version dropdown after another client created/deleted versions, or a hard-coded version number from a different graph.

Common situations: Two builder sessions editing the same agent: session A publishes v3 while session B (still showing v5 from a deleted branch) tries to activate v5; API scripts re-using recorded version numbers across graph re-creations.

Related errors


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