Thank you for posting your question in the Microsoft Q&A forum.
Please note that our forum is a public platform, and we will modify your question to hide your personal information in the description. Kindly ensure that you hide any personal or organizational information the next time you post an error or other details to protect personal data.
Based on the behavior you described and the accompanying JSON examples, I researched further through public resources and community discussions. Your hypothesis: “It looks like Teams removes users from the list that cannot be found, but it still uses an index to resolve them in the message” appears reasonable and does help explain the observed behavior.
To elaborate, if Teams indeed uses this rendering mechanism, the process likely works as follows:
-  Teams parses the <at>tags in the message body sequentially and maps them to themsteams.entitiesarray by index.
-  When an entity cannot be resolved (e.g., invalid mentioned.id), that entity is dropped from the array, but the original<at>tag remains in the text.
-  As a result, subsequent valid entities shift forward and replace earlier <at>tags, causing the mismatch you observed.
To confirm this more precisely, you could test by sending three mentions where one in the middle is invalid and check whether the last two mentions shift positions.
Thank you again for providing such a clear description and JSON samples, this is extremely helpful for the community. For even greater impact, I encourage you to raise this feedback on the official Microsoft Feedback Portal so the product team can review and consider improvements to make the experience more consistent.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.