Repository navigation
Fix "Email not found" when opening a DM with a brand-new email after creating an expense - #100596
Conversation
…er receives a locally generated accountID
|
@marufsharifi Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@MelvinBot Review. |
|
🤖 Code review: LGTM — the fix is correct, minimal, and matches existing precedent. One non-blocking note below. The diagnosis holds up. The claim that email alone is enough is verifiable in the codebase: Non-blocking notes
🤖 Web test steps verification results: Steps 1–4 confirm the fix: creating a manual expense for a brand-new email navigates to the new DM with the expense preview and no "Email not found" error, with
Step 4 is marked view run · no recording available |
|
@ahmdshrif, could you please check the above comments. thanks. |
…erated ones Gate on isOptimisticPersonalDetail instead of stripping accountID for every DM participant, so the server still gets a real accountID to disambiguate a stale or secondary cached login. Add an integration test asserting OpenReport is called with an empty accountIDList and a populated emailList for an invited user who has no account yet.
|
@marufsharifi Updated in 4d38877 and replied on both threads:
Ready for another look. |
|
@ahmdshrif, could you please check the above comments? thanks. |
…the optimistic flag Gating on isOptimisticPersonalDetail is not reliable: sendMoney writes the recipient's optimistic personal detail without the flag, so a locally generated accountID would still reach OpenReport from the Pay someone flow. The server resolves a 1:1 DM from emailList alone, so the accountID is never sent. Update the JSDoc to say so, drop the duplicated inline comment, tighten the unit tests to toStrictEqual, add the unflagged optimistic detail case and annotate the integration test fixtures.
|
@marufsharifi Addressed the second round in 0005267 and replied on each thread. The key change: the Ready for another look. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-09-10.at.6.31.47.PM.movAndroid: mWeb ChromeScreen.Recording.2026-09-10.at.5.10.21.PM.moviOS: HybridAppScreen.Recording.2026-09-10.at.10.22.24.PM.moviOS: mWeb SafariScreen.Recording.2026-09-10.at.5.15.03.PM.movMacOS: Chrome / SafariScreen.Recording.2026-09-10.at.5.12.26.PM.mov |
neil-marcellini
left a comment
There was a problem hiding this comment.
Good to go, thanks.
|
🚧 neil-marcellini has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.4.77-0 🚀
|
|
🤖 No help site changes are required for this PR. I did not create a docs PR. Why: This is an internal bug fix, not a behavior or feature change. The only production change is in What I checked
Per If you think a specific article does describe this flow in a way that is now wrong, point me at it and I will open the draft PR. @ahmdshrif, since no docs changes are needed, there is no linked help site PR to review — nothing further is required from you here. view run · no recording available |
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.4.77-4 🚀
Bundle Size Analysis (Sentry): |




Explanation of Change
When a manual expense is created for an email that has no Expensify account yet, the invited recipient is stored with a client-generated accountID (
generateAccountID(email)) and an optimistic personal detail that carries the login. OnceRequestMoneyresolves and the optimistic DM is no longer flagged optimistic,ReportFetchHandlercallsopenReportand passes the other participant fromgetOneOnOneChatParticipants.That helper returned
{login, accountID}for every participant that has a login, so the locally generated ID was sent to the server inaccountIDList. The server has never seen that ID and failsOpenReportwith "Email not found", which lands inreport.errorFields.createChatand is displayed in the newly created DM.This was introduced in #98855, which started passing the DM participants to
OpenReportso a stale/optimistic reportID can self-heal into the real chat. Before that,fetchReportsent no participants, soaccountIDListwas always empty here.The fix is to have
getOneOnOneChatParticipantsreturn the login only:accountIDis already optional onParticipantInfo, soopenReportfilters it out andaccountIDListgoes out empty whileemailListstill carries the login.emailListalone. This is the same payloadnavigateToAndOpenReportsends when creating a DM, and the same rule Fix native share to new user by sending login only to OpenReport #93164 applied for the identical symptom in [Due for payment 2026-06-23] [$250] Native share - "Email not found", "Report no longer exists" error up after sharing attachment #92515 (sharing to a new user).isOptimisticPersonalDetail: not every flow sets that flag (sendMoneywrites the recipient's optimistic personal detail without it), so a flag-gated helper would still send the locally generated ID from Pay someone. Email-only is sufficient for a 1:1 DM, and we accept not sending an accountID here.getOneOnOneChatParticipantshas a single caller (ReportFetchHandler), so no otherOpenReportpayload changes. Unit tests intests/unit/ReportUtilsTest.tswere updated: a real account's accountID is no longer returned, and two new cases assert that an invited user's locally generated accountID is never returned, with and without theisOptimisticPersonalDetailflag. A new integration test intests/actions/ReportTest.tsbuilds the DM participants through the helper and assertsOpenReportis called withemailList: 'new@user.com'andaccountIDList: ''. All fail against the pre-fix helper and pass with the fix.Fixed Issues
$ #99276
PROPOSAL: #99276 (comment)
Tests
newuser+<random>@example.com).createChaterror).Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Notes on the checklist above:
ReportFetchHandlerhas no.nativevariant and no narrow/wide branch, and the helper only affects theOpenReportpayload for 1:1 DMs.RequestMoneyfor the brand-new email, theOpenReportrequest now carriesemailList=<new email>andaccountIDList=(empty), and the DM opens with nocreateChaterror.Screenshots/Videos
Android: Native
android-native.mp4
Android: mWeb Chrome
android-mweb-chrome.mp4
iOS: Native
ios-native-2.mp4
iOS: mWeb Safari
ios-mweb-safari.mp4
MacOS: Chrome / Safari
web-macos-chrome-after.mp4