Significant-Gravitas/AutoGPT · error · ValueError

Cannot change the owner's role flags directly. Use transfer-

Error message

Cannot change the owner's role flags directly. Use transfer-ownership.

What it means

Error "Cannot change the owner's role flags directly. Use transfer-ownership." thrown in Significant-Gravitas/AutoGPT.

Source

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

                "isAdmin": is_admin,
                "status": "ACTIVE",
            }
        )

    return OrgMemberResponse.from_db(member)


async def update_org_member(
    org_id: str, user_id: str, is_admin: bool | None, is_billing_manager: bool | None
) -> OrgMemberResponse:
    """Update a member's role flags."""
    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:
        raise ValueError(
            "Cannot change the owner's role flags directly. Use transfer-ownership."
        )

    update_data: dict = {}
    if is_admin is not None:
        update_data["isAdmin"] = is_admin
    if is_billing_manager is not None:
        update_data["isBillingManager"] = is_billing_manager

    if update_data:
        await prisma.orgmember.update(
            where={"orgId_userId": {"orgId": org_id, "userId": user_id}},
            data=update_data,
        )

    # 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.

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Use the transfer-ownership flow to change the owner's role.
  2. Have another admin adjust non-owner role flags if needed.

When it happens

Trigger: Thrown at autogpt_platform/backend/backend/api/features/orgs/db.py:520 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/c0867a0f8e36f124. Report an issue: GitHub.