Significant-Gravitas/AutoGPT · error · NotFoundError

Agent graph #{graph_id} not found

Error message

Agent graph #{graph_id} not found

What it means

NotFoundError (HTTP 404) from the agent-image generation route when backend.data.graph.get_graph(graph_id, version=None, user_id=user_id) returns None. Because user_id is the authenticated caller, this fires both when the graph ID does not exist AND when the graph exists but belongs to a different user (ownership scoping).

Source

Thrown at autogpt_platform/backend/backend/api/features/store/routes.py:540

    "/submissions/generate_image",
    summary="Generate submission image",
    tags=["store", "private"],
    dependencies=[Security(autogpt_libs.auth.requires_user)],
)
async def generate_image(
    graph_id: str,
    user_id: str = Security(autogpt_libs.auth.get_user_id),
) -> ImageURLResponse:
    """
    Generate an image for a marketplace listing submission based on the properties
    of a given graph.
    """
    graph = await backend.data.graph.get_graph(
        graph_id=graph_id, version=None, user_id=user_id
    )

    if not graph:
        raise NotFoundError(f"Agent graph #{graph_id} not found")
    # Use .jpeg here since we are generating JPEG images
    filename = f"agent_{graph_id}.jpeg"

    existing_url = await store_media.check_media_exists(user_id, filename)
    if existing_url:
        logger.info(f"Using existing image for agent graph {graph_id}")
        return ImageURLResponse(image_url=existing_url)
    # Generate agent image as JPEG
    image = await store_image_gen.generate_agent_image(agent=graph)

    # Create UploadFile with the correct filename and content_type
    image_file = fastapi.UploadFile(
        file=image,
        filename=filename,
    )
    image_url = await store_media.upload_media(
        user_id=user_id, file=image_file, use_file_name=True
    )

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Confirm the graph exists for this user: GET the graph endpoint with the same authenticated user and ID.
  2. If the graph was deleted, re-create or re-fork it before requesting image generation.
  3. Ensure the frontend passes the graph_id from the user's own library, not a store listing's source graph.
Defensive patterns

Strategy: validation

Validate before calling

graph = await backend.data.graph.get_graph(
    graph_id=graph_id, version=None, user_id=user_id
)
if graph is None:
    raise HTTPException(404, f"Graph {graph_id} not available for this user")

Try / catch

try:
    image = await generate_listing_image(graph_id, user_id)
except NotFoundError:
    refresh_agent_library()  # drop stale graph reference
    raise

Prevention

When it happens

Trigger: POST image-generation with a graph_id the caller never owned, a deleted graph, a typo'd UUID, or a graph from another user's template that was never copied into the caller's account.

Common situations: Stale graph ID cached in the frontend after the user deleted the agent; attempting to generate an image for another user's agent; multi-tab flows where the agent was removed.

Related errors


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