{"record":{"id":"8b9250cefcdc2ee8","repo":"appwrite/appwrite","slug":"team-invite-mismatch","errorCode":"team_invite_mismatch","errorMessage":"Invite does not belong to current user ({email})","messagePattern":"Invite does not belong to current user \\((.+?)\\)","errorType":"exception","errorClass":"Appwrite\\Extend\\Exception","httpStatus":401,"severity":"error","filePath":"src/Appwrite/Platform/Modules/Teams/Http/Memberships/Status/Update.php","lineNumber":107,"sourceCode":"            throw new Exception(Exception::MEMBERSHIP_NOT_FOUND);\n        }\n\n        $team = $authorization->skip(fn () => $dbForProject->getDocument('teams', $teamId));\n\n        if ($team->isEmpty()) {\n            throw new Exception(Exception::TEAM_NOT_FOUND);\n        }\n\n        if ($membership->getAttribute('teamInternalId') !== $team->getSequence()) {\n            throw new Exception(Exception::TEAM_MEMBERSHIP_MISMATCH);\n        }\n\n        if (!$proofForToken->verify($secret, $membership->getAttribute('secret'))) {\n            throw new Exception(Exception::TEAM_INVALID_SECRET);\n        }\n\n        if ($userId !== $membership->getAttribute('userId')) {\n            throw new Exception(Exception::TEAM_INVITE_MISMATCH, 'Invite does not belong to current user (' . $targetUser->getAttribute('email') . ')');\n        }\n\n        $hasSession = !$targetUser->isEmpty();\n        if (!$hasSession) {\n            $targetUser->setAttributes($dbForProject->getDocument('users', $userId)->getArrayCopy()); // Get user\n        }\n\n        if ($membership->getAttribute('userInternalId') !== $targetUser->getSequence()) {\n            throw new Exception(Exception::TEAM_INVITE_MISMATCH, 'Invite does not belong to current user (' . $targetUser->getAttribute('email') . ')');\n        }\n\n        if ($membership->getAttribute('confirm') === true) {\n            throw new Exception(Exception::MEMBERSHIP_ALREADY_CONFIRMED);\n        }\n\n        $membership // Attach user to team\n            ->setAttribute('joined', DateTime::now())\n            ->setAttribute('confirm', true)","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/appwrite/appwrite/blob/ce3a85157f30ff289c7511f62ff076005fa106d1/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Status/Update.php#L89-L125","documentation":"Error \"Invite does not belong to current user ({email})\" thrown in appwrite/appwrite.","triggerScenarios":"Thrown at src/Appwrite/Platform/Modules/Teams/Http/Memberships/Status/Update.php:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Accept the invitation with the account whose email matches the invite.","Sign in as the invited user and retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ce3a85157f30ff289c7511f62ff076005fa106d1","analyzedAt":"2026-08-18T21:34:56.994Z","contentChangedAt":"2026-08-18T21:34:56.994Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}