Significant-Gravitas/AutoGPT · warning · ValueError

No agent selected. Please select an agent before submitting

Error message

No agent selected. Please select an agent before submitting to the store.

What it means

ValueError raised inside create_store_submission when the agent graph lookup fails AND graph_id is empty or whitespace-only. It exists to give the marketplace submission UI an actionable message ('select an agent') instead of a cryptic not-found. Note the lookup itself is scoped to {id, version, userId}, so an empty string never matches and always lands here.

Source

Thrown at autogpt_platform/backend/backend/api/features/store/db.py:897

        # Sanitize slug to only allow letters and hyphens
        slug = "".join(
            c if c.isalpha() or c == "-" or c.isnumeric() else "" for c in slug
        ).lower()

        # First verify the agent graph belongs to this user
        graph = await prisma.models.AgentGraph.prisma().find_first(
            where={"id": graph_id, "version": graph_version, "userId": user_id},
            include={"User": {"include": {"Profile": True}}},
        )

        if not graph:
            logger.warning(
                f"Agent graph {graph_id} v{graph_version} not found for user {user_id}"
            )
            # Provide more user-friendly error message when graph_id is empty
            if not graph_id or graph_id.strip() == "":
                raise ValueError(
                    "No agent selected. "
                    "Please select an agent before submitting to the store."
                )
            else:
                raise NotFoundError(
                    f"Agent #{graph_id} v{graph_version} not found "
                    f"for this user (#{user_id})"
                )

        if not graph.User or not graph.User.Profile:
            logger.warning(f"User #{user_id} does not have a Profile")
            raise PreconditionFailed(
                "User must create a Marketplace Profile before submitting an agent"
            )

        async with transaction() as tx:
            # Determine next version number for this listing
            existing_listing = await prisma.models.StoreListing.prisma(tx).find_unique(

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Disable the submit button until a valid graph_id is selected in the UI.
  2. Validate client-side: if (!graphId?.trim()) show 'select an agent' instead of calling the API.
  3. In the API layer, declare graph_id as a required min-length-1 field so FastAPI returns 422 before the DB call.

Example fix

// before
<button onClick={() => submit({ graph_id: selectedAgent?.id ?? '' })}>Publish</button>
// after
<button disabled={!selectedAgent} onClick={() => submit({ graph_id: selectedAgent.id })}>Publish</button>
Defensive patterns

Strategy: validation

Validate before calling

if (!form.graph_id || !form.graph_id.trim()) {
  setError('Select an agent to publish');
  return;
}
await api.createSubmission(form);

Type guard

function hasSelectedAgent(graphId: string | null | undefined): graphId is string {
  return typeof graphId === 'string' && graphId.trim().length > 0;
}

Prevention

When it happens

Trigger: POST /store/submissions with graph_id '' or ' ' — typically a frontend submitting the form before an agent is chosen, or a default-initialized empty agent field in state.

Common situations: Submit button enabled with no agent selected in the publish dialog; state reset to '' by a refetch but submission fired from stale closure; automated tests posting empty payloads.

Related errors


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