Significant-Gravitas/AutoGPT · error · HTTPException

Graph #{graph_id} v{schedule_params.graph_version} not found

Error message

Graph #{graph_id} v{schedule_params.graph_version} not found.

What it means

Schedule-creation endpoint raises 404 when `graph_db.get_graph(graph_id, version=schedule_params.graph_version, user_id=user_id)` returns None. The graph lookup is user-scoped and version-aware: graph_version defaults to None in ScheduleCreationRequest, and a None version resolves to the latest version — so the 404 means either the graph ID doesn't exist for this user, or the explicitly requested version number doesn't.

Source

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

@v1_router.post(
    path="/graphs/{graph_id}/schedules",
    summary="Create execution schedule",
    tags=["schedules"],
    dependencies=[Security(requires_user)],
)
async def create_graph_execution_schedule(
    user_id: Annotated[str, Security(get_user_id)],
    ctx: Annotated[RequestContext, Security(get_request_context)],
    graph_id: str = Path(..., description="ID of the graph to schedule"),
    schedule_params: ScheduleCreationRequest = Body(),
) -> scheduler.GraphExecutionJobInfo:
    graph = await graph_db.get_graph(
        graph_id=graph_id,
        version=schedule_params.graph_version,
        user_id=user_id,
    )
    if not graph:
        raise HTTPException(
            status_code=404,
            detail=f"Graph #{graph_id} v{schedule_params.graph_version} not found.",
        )

    # Use timezone from request if provided, otherwise fetch from user profile
    if schedule_params.timezone:
        user_timezone = schedule_params.timezone
    else:
        user = await get_user_by_id(user_id)
        user_timezone = get_user_timezone_or_utc(user.timezone if user else None)

    # Expert attribution: explicit expert_id must be an active expert owned
    # by the caller; when omitted, a unique (user, graph) → expert match
    # keeps attribution for schedules created through the generic UI.
    expert_id = schedule_params.expert_id
    if expert_id is not None:
        expert = await experts_db.get_expert(
            user_id, expert_id, include_workflows=False

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. List the user's graphs (GET /graphs) and confirm graph_id belongs to the authenticated user.
  2. If passing graph_version, verify that exact version exists (GET /graphs/{graph_id}); omit it to target the latest version.
  3. For template graphs, fork/publish them into the user's workspace before scheduling.
  4. Check for whitespace or URL-encoding issues in graph_id.

Example fix

// before — hardcoding a version that may not exist
await api.createSchedule({graphId, graphVersion: 3, name, cron, inputs});
// after — resolve latest version first
const graph = await api.getGraph(graphId);
await api.createSchedule({graphId, graphVersion: graph.version, name, cron, inputs});
Defensive patterns

Strategy: validation

Validate before calling

const graph = await api.getGraph(graphId);
if (!graph) throw new Error('Graph not found for this user');
const versions = graph.versions.map(v => v.version);
if (params.graphVersion != null && !versions.includes(params.graphVersion)) {
  params.graphVersion = graph.version; // fall back to latest
}

Type guard

function hasVersion(graph: GraphDTO, v: number | null | undefined): boolean {
  return v == null || graph.versions.some(ver => ver.version === v);
}

Try / catch

try {
  return await api.createSchedule({graphId, graphVersion, ...});
} catch (e) {
  if (e.status === 404) throw new Error(`Graph ${graphId} or version ${graphVersion} unavailable`);
  throw e;
}

Prevention

When it happens

Trigger: POST /v1/schedules (create_graph_execution_schedule) with a graph_id never created by this user, a graph_id copied from another user/template, or graph_version set to a version that was never published (e.g. version 3 when only v1–v2 exist).

Common situations: Scheduling right after deleting a graph or a graph version; using template/marketplace graph IDs that were never forked into the user's workspace; sending graph_version as a string or off-by-one from the UI's version selector.

Related errors


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