Significant-Gravitas/AutoGPT · warning · HTTPException

Graph #{graph_id} not found in user's library

Error message

Graph #{graph_id} not found in user's library

What it means

Raised (404) by PUT /graphs/{graph_id}/settings when library_db.get_library_agent_by_graph_id finds no library agent for that graph_id and user. Graph settings (like the library agent's display settings) live on the user's library-agent record, so this fails when the graph exists but was never added to the user's library, or was removed from it.

Source

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

@v1_router.patch(
    path="/graphs/{graph_id}/settings",
    summary="Update graph settings",
    tags=["graphs"],
    dependencies=[Security(requires_user)],
)
async def update_graph_settings(
    graph_id: str,
    settings: GraphSettings,
    user_id: Annotated[str, Security(get_user_id)],
    ctx: Annotated[RequestContext, Security(get_request_context)],
) -> GraphSettings:
    """Update graph settings for the user's library agent."""
    library_agent = await library_db.get_library_agent_by_graph_id(
        graph_id=graph_id, user_id=user_id
    )
    if not library_agent:
        raise HTTPException(404, f"Graph #{graph_id} not found in user's library")

    updated_agent = await library_db.update_library_agent(
        library_agent_id=library_agent.id,
        user_id=user_id,
        settings=settings,
    )

    return GraphSettings.model_validate(updated_agent.settings)


@v1_router.post(
    path="/graphs/{graph_id}/execute/{graph_version}",
    summary="Execute graph agent",
    tags=["graphs"],
    dependencies=[Security(requires_user), Depends(enforce_payment_paywall)],
    # The route dep enforces fail-closed (503-on-blip) so a transient
    # Supabase outage surfaces as a retryable error, not a free run
    # for a paywalled user. The deep gate inside ``add_graph_execution``

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Add/clone the agent into the user's library first (library add endpoint), then retry the settings update.
  2. If it was removed, re-add it and reapply settings.
  3. Verify with the library listing endpoint that a library agent exists for this graph_id before showing an editable settings UI.
Defensive patterns

Strategy: validation

Validate before calling

const library = await api.listLibraryAgents();
const inLibrary = library.some(a => a.graph_id === graphId);
if (!inLibrary) { await api.addGraphToLibrary(graphId); }
await api.updateGraphSettings(graphId, settings);

Type guard

const isGraphInLibrary = (id: string, agents: LibraryAgent[]) => agents.some(a => a.graphId === id);

Try / catch

catch (e) { if (e.response?.status === 404 && /library/.test(e.response.data.detail)) { promptAddToLibrary(); } else throw e; }

Prevention

When it happens

Trigger: Updating settings for a graph the user can reference (e.g. marketplace agent) but has not cloned/added to their library; after removing the agent from the library while a settings panel stayed open.

Common situations: Marketplace flows where the graph is visible but not yet in 'My Library'; library sync lag right after graph creation; settings pages left open across a library reset.

Related errors


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