You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-05-20] [$250] User is not redirected to the concierge chat after clearing the create chat error #83779
Version Number: 9.3.27-2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@bernhardoj Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Turn on "Simulate failing network requests"
2. Go to Inbox
3. Press the global create button > Start chat
4. Start a chat with a user you never chatted with before. The chat creation should be failed.
5. Tap the create chat error clear button
Expected Result:
User redirected to the concierge chat
Actual Result:
User stay at the error report
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Please re-state the problem that we are trying to solve in this issue.
When a 1:1 chat creation fails (e.g., with "Simulate failing network requests" enabled), tapping the error clear/dismiss button does not redirect the user to the Concierge chat. The user stays on the failed report screen.
What is the root cause of that problem?
The openReport function's failureData for new 1:1 chat creation is missing errorFields.createChat. When the API request fails, the failure handler only sets isLoadingInitialReportActions: false on the report metadata — it does not set any error fields on the report itself.
Compare this with addWorkspaceRoom at line 3593-3601, which correctly includes errorFields.addWorkspaceRoom in its failureData.
Because errorFields.createChat is never set on failure, the OfflineWithFeedback component in ReportActionItemCreated (line 44) receives undefined for its errors prop, so no error banner is shown. And when the error IS somehow displayed and dismissed, clearCreateChatError (line 3688-3697) should call navigateToConciergeChatAndDeleteReport, but the missing error field means the flow doesn't work as intended.
What changes do you think we should make in order to solve the problem?
Add errorFields.createChat to the failureData in openReport when creating a new report (isCreatingNewReport is true and shouldAddPendingFields is true). This should be added inside the if (isCreatingNewReport) block (around line 1413) as an additional push to the failureData array:
In App/src/libs/actions/Report/index.ts, inside the if (isCreatingNewReport) block, push to failureData:
Set errorFields.createChat with getMicroSecondOnyxErrorWithTranslationKey('report.genericCreateReportFailureMessage') on the report (matching the pattern used by addWorkspaceRoom)
This ensures:
The error banner is shown via OfflineWithFeedback in ReportActionItemCreated when chat creation fails
When the user taps the dismiss button, clearCreateChatError is called. Since isOptimisticReport remains true (failureData doesn't change it), the condition errorFields.createChat && !isOptimisticReport evaluates to false, correctly falling through to navigateToConciergeChatAndDeleteReport which navigates to Concierge and deletes the failed optimistic report
What alternative solutions did you explore? (Optional)
An alternative would be to also modify clearCreateChatError to always navigate away after clearing errors (even for non-optimistic reports). However, the current conditional logic at line 3691 is intentional — for real (non-optimistic) reports that have a createChat error from the server, clearing the error without deleting the report is correct behavior. The root cause is simply the missing error field in the failure data.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
changed the title [-]User is not redirected to the concierge chat after clearing the create chat error[/-][+][$250] User is not redirected to the concierge chat after clearing the create chat error[/+]on Feb 28, 2026
Please re-state the problem that we are trying to solve in this issue.
User is not redirected to the concierge chat after clearing the create chat error
What is the root cause of that problem?
clearCreateChatError uses !isOptimisticReport in its condition. On native apps, isOptimisticReport return undefined in report metadata, so !undefined is true.
The function then clears the error and returns instead of calling navigateToConciergeChatAndDeleteReport.
What changes do you think we should make in order to solve the problem?
We can only clear the error and return when isOptimisticReport is explicitly false. When it is true or undefined, navigate to concierge chat (and delete the report).
But when openReport or updateLastVisitTime functions is called, it overwrites the reportMetadata that contains isOptimisticReport, even though we use MERGE operation.
Thanks for the feedback bernhardoj — I investigated the code references you shared and here's what I found:
Your observation about the IOU flow is valid. In IOU/index.ts:2439-2457, errorFields.createChat IS correctly set in failureData, and isOptimisticReport: true IS correctly set in optimistic data at IOU/index.ts:2104-2112. This part of the code handles IOU-triggered chat creation properly.
However, for the specific "Start chat" flow in this issue (Create button → Start chat → select new user), the code path is different:
NewChatPage.tsx:401 → navigateToAndOpenReport → openReport with newReportObject
The IOU code is not involved in this flow
openReport's failureData (Report/index.ts:1660-1668) only sets {isLoadingInitialReportActions: false} — no errorFields.createChat
Regarding the Onyx MERGE overwrite you described: I traced the Onyx internals (Onyx.js:386-402) and found that fastMerge in utils.js:9-96does correctly preserve existing keys during a standalone MERGE. However, there IS a race condition that can cause isOptimisticReport to be lost:
IOU's API.write() fires Onyx.update(optimisticData) asynchronously (fire-and-forget at API/index.ts:90)
Navigation to ReportScreen happens synchronously before the Onyx cache is updated
updateLastVisitTime (Report/index.ts:4934) fires from ReportScreen's useEffect — its Onyx.merge finds no value in cache yet, so the result is just {lastVisitTime: ...} without isOptimisticReport
fetchReport guard at ReportScreen.tsx:535 sees isOptimisticReport as undefined → incorrectly calls openReport
So it's not that MERGE overwrites existing keys — it's that the async Onyx operations haven't completed before the UI reads the state. This is a valid race condition that would affect the IOU-triggered chat creation flow.
Summary — there appear to be two related bugs:
Flow
Root Cause
Missing
"Start chat" (this issue's steps)
openReport failureData incomplete
errorFields.createChat not set on failure
IOU-triggered chat creation
Race condition in async Onyx operations
isOptimisticReport lost due to timing
Both result in the same symptom: user stays on the error report instead of being redirected to concierge.
If you believe the issue's reproduction steps primarily hit the IOU flow rather than the direct "Start chat" flow, I'd appreciate the clarification — that would shift the fix target toward addressing the Onyx race condition as you suggested.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
Contributor: @TaduJR paid $500 via Upwork
Contributor+: @hungvu193 due $500 via NewDot
@TaduJR can you please accept the job below? Please reply here and tag me once you have.
If you're not sent an offer in Upwork when you're assigned to an issue, and an Upwork job exists, please submit a proposal. https://www.upwork.com/jobs/~022059707428274199461
@TaduJR in a dedicated post, can you enter your Upwork details? I'm hoping they'll be saved to send you auto-offers in the future. (please do again even if I'll already ask and you've done before) Thx
Activity
melvin-bot commentedon Feb 28, 2026
Triggered auto assignment to @laurenreidexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.MelvinBot commentedon Feb 28, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a 1:1 chat creation fails (e.g., with "Simulate failing network requests" enabled), tapping the error clear/dismiss button does not redirect the user to the Concierge chat. The user stays on the failed report screen.
What is the root cause of that problem?
The
openReportfunction'sfailureDatafor new 1:1 chat creation is missingerrorFields.createChat. When the API request fails, the failure handler only setsisLoadingInitialReportActions: falseon the report metadata — it does not set any error fields on the report itself.Specifically, at
App/src/libs/actions/Report/index.ts:1660-1668, the failureData is:Compare this with
addWorkspaceRoomatline 3593-3601, which correctly includeserrorFields.addWorkspaceRoomin its failureData.Because
errorFields.createChatis never set on failure, theOfflineWithFeedbackcomponent inReportActionItemCreated(line 44) receivesundefinedfor itserrorsprop, so no error banner is shown. And when the error IS somehow displayed and dismissed,clearCreateChatError(line 3688-3697) should callnavigateToConciergeChatAndDeleteReport, but the missing error field means the flow doesn't work as intended.What changes do you think we should make in order to solve the problem?
Add
errorFields.createChatto thefailureDatainopenReportwhen creating a new report (isCreatingNewReportis true andshouldAddPendingFieldsis true). This should be added inside theif (isCreatingNewReport)block (around line 1413) as an additional push to thefailureDataarray:In
App/src/libs/actions/Report/index.ts, inside theif (isCreatingNewReport)block, push tofailureData:errorFields.createChatwithgetMicroSecondOnyxErrorWithTranslationKey('report.genericCreateReportFailureMessage')on the report (matching the pattern used byaddWorkspaceRoom)This ensures:
OfflineWithFeedbackinReportActionItemCreatedwhen chat creation failsclearCreateChatErroris called. SinceisOptimisticReportremainstrue(failureData doesn't change it), the conditionerrorFields.createChat && !isOptimisticReportevaluates tofalse, correctly falling through tonavigateToConciergeChatAndDeleteReportwhich navigates to Concierge and deletes the failed optimistic reportWhat alternative solutions did you explore? (Optional)
An alternative would be to also modify
clearCreateChatErrorto always navigate away after clearing errors (even for non-optimistic reports). However, the current conditional logic at line 3691 is intentional — for real (non-optimistic) reports that have acreateChaterror from the server, clearing the error without deleting the report is correct behavior. The root cause is simply the missing error field in the failure data.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.melvin-bot commentedon Feb 28, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hungvu193 (
External)melvin-bot commentedon Feb 28, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022027547153968189786
[-]User is not redirected to the concierge chat after clearing the create chat error[/-][+][$250] User is not redirected to the concierge chat after clearing the create chat error[/+]ryntgh commentedon Feb 28, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
User is not redirected to the concierge chat after clearing the create chat error
What is the root cause of that problem?
clearCreateChatErroruses!isOptimisticReportin its condition. On native apps,isOptimisticReportreturnundefinedin report metadata, so!undefinedistrue.The function then clears the error and returns instead of calling
navigateToConciergeChatAndDeleteReport.App/src/libs/actions/Report/index.ts
Lines 3691 to 3696 in 5023f38
What changes do you think we should make in order to solve the problem?
We can only clear the error and return when
isOptimisticReportis explicitlyfalse. When it istrueorundefined, navigate to concierge chat (and delete the report).App/src/libs/actions/Report/index.ts
Line 3691 in 5023f38
What alternative solutions did you explore? (Optional)
N/A
bernhardoj commentedon Feb 28, 2026
@MelvinBot This is most likely a react-native-onyx issue.
We add the
createChaterror hereApp/src/libs/actions/IOU/index.ts
Lines 2439 to 2457 in 5023f38
and when creating the chat optimistically, we already set the
isOptimisticReportto true.App/src/libs/actions/IOU/index.ts
Lines 2104 to 2112 in 5023f38
But when
openReportorupdateLastVisitTimefunctions is called, it overwrites thereportMetadatathat containsisOptimisticReport, even though we use MERGE operation.App/src/libs/actions/Report/index.ts
Lines 4930 to 4935 in 5023f38
App/src/libs/actions/Report/index.ts
Lines 1162 to 1209 in 5023f38
MelvinBot commentedon Feb 28, 2026
Thanks for the feedback
bernhardoj— I investigated the code references you shared and here's what I found:Your observation about the IOU flow is valid. In
IOU/index.ts:2439-2457,errorFields.createChatIS correctly set in failureData, andisOptimisticReport: trueIS correctly set in optimistic data atIOU/index.ts:2104-2112. This part of the code handles IOU-triggered chat creation properly.However, for the specific "Start chat" flow in this issue (Create button → Start chat → select new user), the code path is different:
NewChatPage.tsx:401→navigateToAndOpenReport→openReportwithnewReportObjectopenReport's failureData (Report/index.ts:1660-1668) only sets{isLoadingInitialReportActions: false}— noerrorFields.createChatRegarding the Onyx MERGE overwrite you described: I traced the Onyx internals (
Onyx.js:386-402) and found thatfastMergeinutils.js:9-96does correctly preserve existing keys during a standalone MERGE. However, there IS a race condition that can causeisOptimisticReportto be lost:API.write()firesOnyx.update(optimisticData)asynchronously (fire-and-forget atAPI/index.ts:90)updateLastVisitTime(Report/index.ts:4934) fires from ReportScreen's useEffect — itsOnyx.mergefinds no value in cache yet, so the result is just{lastVisitTime: ...}withoutisOptimisticReportfetchReportguard atReportScreen.tsx:535seesisOptimisticReportasundefined→ incorrectly callsopenReportSo it's not that MERGE overwrites existing keys — it's that the async Onyx operations haven't completed before the UI reads the state. This is a valid race condition that would affect the IOU-triggered chat creation flow.
Summary — there appear to be two related bugs:
openReportfailureData incompleteerrorFields.createChatnot set on failureisOptimisticReportlost due to timingBoth result in the same symptom: user stays on the error report instead of being redirected to concierge.
If you believe the issue's reproduction steps primarily hit the IOU flow rather than the direct "Start chat" flow, I'd appreciate the clarification — that would shift the fix target toward addressing the Onyx race condition as you suggested.
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.128 remaining items
hungvu193 commentedon May 27, 2026
Sounds good to me
TaduJR commentedon May 27, 2026
Sounds good to me too.
Thanks!
mallenexpensify commentedon May 27, 2026
Payment Summary
Contributor: @TaduJR paid $500 via Upwork
Contributor+: @hungvu193 due $500 via NewDot
@TaduJR can you please accept the job below? Please reply here and tag me once you have.
If you're not sent an offer in Upwork when you're assigned to an issue, and an Upwork job exists, please submit a proposal.
https://www.upwork.com/jobs/~022059707428274199461
^ Test case created. Thx
TaduJR commentedon May 27, 2026
Sure.
Already submitted proposal on upwork and commented before. But will do it again as you suggested.
@mallenexpensify
The offer says $250, Should I accept it? I think it can be edited after acceptance right?
mallenexpensify commentedon May 27, 2026
Please accept @TaduJR I can always increase the price by adding a bonus
Strange, I don't see anything in Upwork. If you have a link, can you share? (Having trouble accessing Upwork right now to dive in more)
JmillsExpensify commentedon May 28, 2026
$500 approved for @hungvu193
TaduJR commentedon May 28, 2026
Oh I wasn't taking about the above offer. But I applied before on two proposal.
@mallenexpensify
When applying on upwork it says "Only invited users can find, view and apply to the job"
mallenexpensify commentedon May 28, 2026
@TaduJR can you try again?
https://www.upwork.com/jobs/~022059707428274199461
TaduJR commentedon May 29, 2026
@mallenexpensify
Mac-Chrome.mp4
Still the same. Am I missing something?
mallenexpensify commentedon May 29, 2026
@TaduJR unsure of the bug and want to avoid a 🐰🕳 so I created another one, try this
https://www.upwork.com/nx/wm/offer/111571398
TaduJR commentedon May 29, 2026
Offer Accepted @mallenexpensify
Thanks!
mallenexpensify commentedon May 29, 2026
@TaduJR paid, summary updated above. Thx.
It's $250 for the job and $250 bonus added (to get to $500 that's in the summary above)