Significant-Gravitas/AutoGPT · error · HTTPException

Graph #{graph_id} not found.

Error message

Graph #{graph_id} not found.

What it means

HTTP 404 raised by GET /api/v1/graphs/{graph_id}/executions/{graph_exec_id} in the external v1 API. The execution row itself was found, but the graph lookup with the execution's stored graph_id/graph_version under the authenticated user_id returned nothing. This happens when the graph was deleted, its version was removed, or the execution belongs to a different user (the DB query scopes graphs by user_id).

Source

Thrown at autogpt_platform/backend/backend/api/external/v1/routes.py:288

        require_permission(APIKeyPermission.READ_GRAPH)
    ),
) -> GraphExecutionResult:
    graph_exec = await execution_db.get_graph_execution(
        user_id=auth.user_id,
        execution_id=graph_exec_id,
        include_node_executions=True,
    )
    if not graph_exec:
        raise HTTPException(
            status_code=404, detail=f"Graph execution #{graph_exec_id} not found."
        )

    if not await graph_db.get_graph(
        graph_id=graph_exec.graph_id,
        version=graph_exec.graph_version,
        user_id=auth.user_id,
    ):
        raise HTTPException(status_code=404, detail=f"Graph #{graph_id} not found.")

    return GraphExecutionResult(
        execution_id=graph_exec_id,
        status=graph_exec.status.value,
        nodes=[
            ExecutionNode(
                node_id=node_exec.node_id,
                input=node_exec.input_data.get("value", node_exec.input_data),
                output={k: v for k, v in node_exec.output_data.items()},
            )
            for node_exec in graph_exec.node_executions
        ],
        output=(
            [
                {name: value}
                for name, values in graph_exec.outputs.items()
                for value in values
            ]

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Verify the graph still exists and is owned by the same user: call GET /api/v1/graphs and check both graph_id and version.
  2. If the graph was deleted, the execution result is orphaned — re-run the workflow from a current graph version.
  3. Confirm you are querying with the API key of the user who created the graph; executions made from another user's template store that user's graph ownership.
  4. Check the AgentGraph table (Prisma) for the exact (id, version, userId) triple if you have DB access.
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(`/api/v1/graphs/${graphId}/executions/${execId}`, opts);
if (res.status === 404) {
  // Distinguish: execution missing vs graph missing via detail text
  const { detail } = await res.json();
  if (detail.startsWith('Graph #')) {
    // execution exists but graph deleted/not owned — result is orphaned
  }
}

Try / catch

try { const r = await api.getExecution(graphId, execId); } catch (e) { if (e.status === 404 && e.detail?.includes('Graph #')) { /* treat as orphaned execution, prompt re-run from live graph */ } else { throw e; } }

Prevention

When it happens

Trigger: Calling GET /api/v1/graphs/{graph_id}/executions/{graph_exec_id} where (a) the execution exists but the graph was deleted after the run, (b) the graph_version stored on the execution no longer exists (version purged), or (c) the API key's user_id does not own the graph — note the route checks graph_exec.graph_id, not the path graph_id, so a mismatched path id alone does not trigger this.

Common situations: Querying execution results for an agent template deleted from the builder; org sharing where one user ran a graph another user owns; multi-version graphs where an old version was cleaned up; copying an execution_id between environments (dev vs prod).

Related errors


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