appwrite/appwrite · error · Appwrite\Extend\Exception

team_already_exists

team_already_exists

Error message

Team with requested ID already exists. Please choose a different ID and try again.

What it means

Error "Team with requested ID already exists. Please choose a different ID and try again." thrown in appwrite/appwrite.

Source

Thrown at src/Appwrite/Platform/Modules/Teams/Http/Teams/Create.php:93

        $teamId = $teamId == 'unique()' ? ID::unique() : $teamId;

        try {
            $team = $authorization->skip(fn () => $dbForProject->createDocument('teams', new Document([
                '$id' => $teamId,
                '$permissions' => [
                    Permission::read(Role::team($teamId)),
                    Permission::update(Role::team($teamId, 'owner')),
                    Permission::delete(Role::team($teamId, 'owner')),
                ],
                'labels' => [],
                'name' => $name,
                'total' => ($isPrivilegedUser || $isAppUser) ? 0 : 1,
                'prefs' => new \stdClass(),
                'search' => implode(' ', [$teamId, $name]),
            ])));
        } catch (Duplicate $th) {
            throw new Exception(Exception::TEAM_ALREADY_EXISTS);
        }

        if (!$isPrivilegedUser && !$isAppUser) { // Don't add user on server mode
            if (!\in_array('owner', $roles)) {
                $roles[] = 'owner';
            }

            $membershipId = ID::unique();
            $membership = new Document([
                '$id' => $membershipId,
                '$permissions' => [
                    Permission::read(Role::user($user->getId())),
                    Permission::read(Role::team($team->getId())),
                    Permission::update(Role::user($user->getId())),
                    Permission::update(Role::team($team->getId(), 'owner')),
                    Permission::delete(Role::user($user->getId())),
                    Permission::delete(Role::team($team->getId(), 'owner')),
                ],

View on GitHub (pinned to a1d520eea4)

Solutions

  1. Choose a different, unique ID for the new resource.
  2. Use ID.unique() to let the server generate an ID.
  3. Check for an existing resource with the same ID or unique attribute before creating.

When it happens

Trigger: Thrown at src/Appwrite/Platform/Modules/Teams/Http/Teams/Create.php:93 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of appwrite/appwrite@a1d520eea4 (2026-08-18). Data as JSON: /api/errors/823b899462ec7e0a. Report an issue: GitHub.