Significant-Gravitas/AutoGPT · warning · HTTPException

Execution not found

Error message

Execution not found

What it means

Raised (404) by POST /graphs/{graph_id}/executions/{graph_exec_id}/share when execution_db.get_graph_execution(user_id, graph_exec_id) returns nothing — the execution does not exist for this user, so sharing is refused before any share token is generated. Note the pre-check omits organization_id, unlike the GET path.

Source

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

@v1_router.post(
    "/graphs/{graph_id}/executions/{graph_exec_id}/share",
    dependencies=[Security(requires_user)],
)
async def enable_execution_sharing(
    graph_id: Annotated[str, Path],
    graph_exec_id: Annotated[str, Path],
    user_id: Annotated[str, Security(get_user_id)],
    ctx: Annotated[RequestContext, Security(get_request_context)],
    _body: ShareRequest = Body(default=ShareRequest()),
) -> ShareResponse:
    """Enable sharing for a graph execution."""
    # Verify the execution belongs to the user
    execution = await execution_db.get_graph_execution(
        user_id=user_id, execution_id=graph_exec_id
    )
    if not execution:
        raise HTTPException(status_code=404, detail="Execution not found")

    # Generate a unique share token
    share_token = generate_share_token()

    # Remove stale allowlist records before updating the token — prevents a
    # window where old records + new token could coexist.
    await execution_db.delete_shared_execution_files(execution_id=graph_exec_id)

    # Update the execution with share info — the underlying update_many
    # also enforces (id, user_id) at the DB layer, so a TOCTOU delete
    # between the pre-check above and this write surfaces as 404 rather
    # than a silent no-op.
    try:
        await execution_db.update_graph_execution_share_status(
            execution_id=graph_exec_id,
            user_id=user_id,
            is_shared=True,
            share_token=share_token,

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Verify the execution appears in the user's run list (GET executions) before exposing the share action.
  2. On 404, close the share dialog and show 'run no longer available' — do not retry.
  3. Backend-side, hide share buttons for executions older than the retention window.
Defensive patterns

Strategy: validation

Validate before calling

const runs = await api.listExecutions(graphId);
if (!runs.some(r => r.execution_id === graphExecId)) { closeShareDialog('Run no longer available'); return; }
await api.shareExecution(graphId, graphExecId);

Type guard

const isShareableExecution = (id: string, runs: {execution_id: string}[]) => runs.some(r => r.execution_id === id);

Try / catch

catch (e) { if (e.response?.status === 404 && /Execution not found/.test(e.response.data.detail)) { closeShareDialog(); notifyRunExpired(); } else throw e; }

Prevention

When it happens

Trigger: Clicking 'Share' on a run that was deleted or retention-expired, an execution ID from another user, or a stale share dialog after the run list refreshed.

Common situations: Share dialogs left open while the underlying run is cleaned up; deep links to old runs after a workspace reset; attempting to share onboarding/sample executions that were purged.

Related errors


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