Significant-Gravitas/AutoGPT · error · PreconditionFailed

User is not a member of the specified organization

Error message

User is not a member of the specified organization

What it means

PreconditionFailed raised inside create_store_submission when organization_id is provided but no OrgMember row links the authenticated user to that organization. It is an authorization-of-intent check: you may only submit an agent to a store listing owned by an organization you belong to. The API maps PreconditionFailed to HTTP 412/409-class responses, telling the client to fix state before retrying.

Source

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

        sub_heading: Optional sub-heading for the agent
        categories: List of categories for the agent
        changes_summary: Summary of changes made in this submission

    Returns:
        StoreSubmission: The created store submission
    """
    logger.debug(
        f"Creating store submission for user #{user_id}, "
        f"graph #{graph_id} v{graph_version}"
    )

    async def verify_org_membership(org_id: str, uid: str) -> None:
        """Check that user is a member of the specified organization."""
        member = await prisma.models.OrgMember.prisma().find_first(
            where={"orgId": org_id, "userId": uid}
        )
        if not member:
            raise PreconditionFailed(
                "User is not a member of the specified organization"
            )

    try:
        # Verify org membership when submitting on behalf of an organization
        if organization_id:
            await verify_org_membership(organization_id, user_id)

        # 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}}},
        )

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Refetch the user's organizations (GET the org-membership endpoint) and re-render the selector before submission.
  2. Confirm the user has an accepted membership row in OrgMember for that orgId in the DB.
  3. If membership should exist, check you are sending the correct organization_id (not the workspace or team name).

Example fix

// before
await api.createSubmission({ graph_id, organization_id: cachedOrg.id, ... });
// after
const orgs = await api.getMyOrganizations();
const org = orgs.find(o => o.id === organization_id);
if (!org) throw new Error('You are not a member of this organization');
await api.createSubmission({ graph_id, organization_id: org.id, ... });
Defensive patterns

Strategy: validation

Validate before calling

const memberships = await api.getMyOrganizations();
const isMember = memberships.some(o => o.id === form.organization_id);
if (form.organization_id && !isMember) {
  setError('You are no longer a member of this team');
  return;
}
await api.createSubmission(form);

Try / catch

from backend.util.exceptions import PreconditionFailed

try:
    sub = await store_db.create_store_submission(...)
except PreconditionFailed as e:
    if 'organization' in str(e):
        ui.show('Join the organization before submitting on its behalf');
        return;
    raise

Prevention

When it happens

Trigger: POST /store/submissions with body organization_id set to an org the user has never joined, was removed from, or a typo'd/stale org ID from the frontend's local state.

Common situations: User was kicked out of a team but the UI still shows the org selector; frontend caching an old org list; testing with a user account that was never invited to the target org.

Related errors


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