Significant-Gravitas/AutoGPT · error · NotFoundError

Member {user_id} not found in org {org_id} after update

Error message

Member {user_id} not found in org {org_id} after update

What it means

Error "Member {user_id} not found in org {org_id} after update" thrown in Significant-Gravitas/AutoGPT.

Source

Thrown at autogpt_platform/backend/backend/api/features/orgs/db.py:552

        )

    # Keep the default-workspace admin flag in step with the org role —
    # add_org_member grants it at add time, so promotion/demotion via PATCH
    # must sync it too or promoted admins stay denied on team-scoped checks.
    if is_admin is not None:
        default_ws = await prisma.team.find_first(
            where={"orgId": org_id, "isDefault": True}
        )
        if default_ws:
            await prisma.teammember.update_many(
                where={"teamId": default_ws.id, "userId": user_id},
                data={"isAdmin": is_admin},
            )

    members = await list_org_members(org_id)
    match = next((m for m in members if m.user_id == user_id), None)
    if match is None:
        raise NotFoundError(f"Member {user_id} not found in org {org_id} after update")
    return match


async def remove_org_member(org_id: str, user_id: str, requesting_user_id: str) -> None:
    """Remove a member from an organization and all its workspaces.

    Guards:
    - Cannot remove the org owner (transfer ownership first)
    - Cannot remove yourself (use leave flow instead)
    - Cannot remove a user who has active schedules (transfer/cancel first)
    - Cannot remove a user who would become org-less (no other org memberships)
    """
    member = await prisma.orgmember.find_unique(
        where={"orgId_userId": {"orgId": org_id, "userId": user_id}}
    )
    if member is None:
        raise NotFoundError(f"Member {user_id} not found in org {org_id}")
    if member.isOwner:

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Retry the update; the member may have been removed concurrently.
  2. Verify the user is still a member of the org before updating.

When it happens

Trigger: Thrown at autogpt_platform/backend/backend/api/features/orgs/db.py:552 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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