Skip to content

[Due for payment 2026-02-03] [$250] Web - Contact Methods - Existing account email gets stuck on Add Contact Method without error #79672

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.2-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/13176687/test-cases/41236654
Email or phone of affected tester (no customers): testing210790+65t@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 11
App Component: Notifications

Action Performed:

  1. Navigate to Account Settings
  2. Open Profile
  3. Click on Contact Method
  4. Click on New Contact Method
  5. Enter an email that already belongs to an existing user account
  6. Click on Add

Expected Result:

The user is redirected to the Contact Methods page and an error is displayed indicating that emails associated with existing accounts cannot be added as secondary contact methods

Actual Result:

After clicking on Add, the page shows a loading state and remains on the Add Contact Method screen. No error message is displayed and the user is not informed that the entered email already belongs to an existing account. The user is unable to proceed or understand why the action failed.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022013780454331793363
  • Upwork Job ID: 2013780454331793363
  • Last Price Increase: 2026-01-21
  • Automatic offers:
    • MobileMage | Contributor | 110180255
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 15, 2026
  2. melvin-bot commented on Jan 15, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (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.

  3. MobileMage commented on Jan 15, 2026

    @MobileMage
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When adding a contact method with an email that already belongs to an existing account, the page shows a loading spinner and gets stuck without displaying any error message.

    What is the root cause of that problem?

    The failureData in addNewContactMethod wipes out the error information from the server.

    Here's what happens:

    1. User enters an email belonging to an existing account
    2. API call is made, server returns error with onyxData containing the error message in LOGIN_LIST[contactMethod].errorFields.addedLogin
    3. Server's onyxData is applied first (this is correct)
    4. Then failureData is applied, which does this:
    // src/libs/actions/User.ts:420-426
    {
        onyxMethod: Onyx.METHOD.MERGE,
        key: ONYXKEYS.LOGIN_LIST,
        value: {
            [contactMethod]: null,  // Erases EVERYTHING including the error
        },
    },

    Setting the entry to null erases the error info the server just sent. The page checks LOGIN_LIST[contactMethod].errorFields.addedLogin for errors, but that's now gone.

    What changes do you think we should make in order to solve the problem?

    Remove the LOGIN_LIST entry from failureData. The server already sends proper error data in its onyxData response - we just need to stop erasing it.

    diff --git a/src/libs/actions/User.ts b/src/libs/actions/User.ts
    --- a/src/libs/actions/User.ts
    +++ b/src/libs/actions/User.ts
    @@ -401,7 +401,7 @@ function addNewContactMethod(contactMethod: string, validateCode = '') {
    -    const failureData: Array<OnyxUpdate<typeof ONYXKEYS.ACCOUNT | typeof ONYXKEYS.VALIDATE_ACTION_CODE | typeof ONYXKEYS.PENDING_CONTACT_ACTION | typeof ONYXKEYS.LOGIN_LIST>> = [
    +    const failureData: Array<OnyxUpdate<typeof ONYXKEYS.ACCOUNT | typeof ONYXKEYS.VALIDATE_ACTION_CODE | typeof ONYXKEYS.PENDING_CONTACT_ACTION>> = [
             {
                 onyxMethod: Onyx.METHOD.MERGE,
                 key: ONYXKEYS.ACCOUNT,
    @@ -417,12 +417,6 @@ function addNewContactMethod(contactMethod: string, validateCode = '') {
                     actionVerified: false,
                 },
             },
    -        {
    -            onyxMethod: Onyx.METHOD.MERGE,
    -            key: ONYXKEYS.LOGIN_LIST,
    -            value: {
    -                [contactMethod]: null,
    -            },
    -        },
         ];

    This way when the server returns an error for "email already exists", the error message stays in LOGIN_LIST[contactMethod].errorFields.addedLogin and gets displayed to the user.

    What alternative solutions did you explore? (Optional)

    Could also update failureData to preserve error fields (like deleteContactMethod does), but that's more complex. Since the server already sends the right error data, simply not erasing it is the cleanest fix.

  4. yatin-italy commented on Jan 15, 2026

    @yatin-italy

    Proposal

    Restate the problem this issue is trying to solve.

    • Adding an email that already exists on another account gets stuck loading.
    • The Add Contact Method screen never finishes.
    • No error is shown to the user.

    What is the root cause of that problem?

    • The client applies a failure fallback.
    • This fallback merges its own Onyx data.
    • It overwrites backend Onyx data.
    • The server error and pending cleanup are erased.
    const failureData = [
        {key: ONYXKEYS.ACCOUNT, value: {isLoading: false}},
        {key: ONYXKEYS.VALIDATE_ACTION_CODE, value: {validateCodeSent: null}},
        {key: ONYXKEYS.LOGIN_LIST, value: {[contactMethod]: null}},
    ];
    API.write('AddNewContactMethod', params, {successData, failureData});
    

    What changes do you think we should make in order to solve the problem?

    • Delete all client-crafted failureData.
    • Let backend Onyx data be the single source of truth.
    • Do not override errors, pending fields, or loading state.
    • Add a short comment to explain this rule.
    • Remove unused imports and types tied to failureData.
    -    const failureData = [
    -        {
    -            onyxMethod: Onyx.METHOD.MERGE,
    -            key: ONYXKEYS.ACCOUNT,
    -            value: {isLoading: false},
    -        },
    -        {
    -            onyxMethod: Onyx.METHOD.MERGE,
    -            key: ONYXKEYS.VALIDATE_ACTION_CODE,
    -            value: {validateCodeSent: null},
    -        },
    -        {
    -            onyxMethod: Onyx.METHOD.MERGE,
    -            key: ONYXKEYS.LOGIN_LIST,
    -            value: {[contactMethod]: null},
    -        },
    -    ];
    -
    -    API.write('AddNewContactMethod', params, {successData, failureData});
    +    // Backend onyxData handles failure cleanup (errors, pending fields, loading); do not override here.
    +    API.write('AddNewContactMethod', params, {successData});
    
  5. ShridharGoel commented on Jan 15, 2026

    @ShridharGoel
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Contact Methods - Existing account email gets stuck on Add Contact Method without showing any error

    What is the root cause of that problem?

    The failure handler clears the new login entry in the login list. The API error is attached to that login entry, so it gets wiped and the UI cannot show it.

    const failureData: Array<OnyxUpdate<typeof ONYXKEYS.ACCOUNT | typeof ONYXKEYS.VALIDATE_ACTION_CODE | typeof ONYXKEYS.PENDING_CONTACT_ACTION | typeof ONYXKEYS.LOGIN_LIST>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: ONYXKEYS.ACCOUNT,
    value: {isLoading: false},
    },
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: ONYXKEYS.VALIDATE_ACTION_CODE,
    value: {validateCodeSent: null},
    },
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: ONYXKEYS.PENDING_CONTACT_ACTION,
    value: {
    isLoading: false,
    actionVerified: false,
    },
    },
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: ONYXKEYS.LOGIN_LIST,
    value: {
    [contactMethod]: null,
    },
    },

    What changes do you think we should make in order to solve the problem?

    Update errorFields.addedLogin in the failureData of the pending contact action.

    Updated code:

    const failureData: Array<OnyxUpdate<typeof ONYXKEYS.ACCOUNT | typeof ONYXKEYS.VALIDATE_ACTION_CODE | typeof ONYXKEYS.PENDING_CONTACT_ACTION | typeof ONYXKEYS.LOGIN_LIST>> = [
        ....
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: ONYXKEYS.PENDING_CONTACT_ACTION,
            value: {
                isLoading: false,
                actionVerified: false,
                errorFields: {
                    addedLogin: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('contacts.genericFailureMessages.addContactMethod'),
                },
            },
        },
    ];
  6. truph01 commented on Jan 16, 2026

    @truph01
    Contributor

    This might be a regression introduced by #77429.

  7. melvin-bot commented on Jan 21, 2026

    @melvin-bot

    @mallenexpensify Eep! 4 days overdue now. Issues have feelings too...

  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jan 21, 2026
  9. melvin-bot commented on Jan 21, 2026

    @melvin-bot
  10. changed the title [-]Web - Contact Methods - Existing account email gets stuck on Add Contact Method without error[/-] [+][$250] Web - Contact Methods - Existing account email gets stuck on Add Contact Method without error[/+] on Jan 21, 2026
  11. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 21, 2026
  12. 12 remaining items

  13. changed the title [-][$250] Web - Contact Methods - Existing account email gets stuck on Add Contact Method without error[/-] [+][Due for payment 2026-02-03] [$250] Web - Contact Methods - Existing account email gets stuck on Add Contact Method without error[/+] on Jan 27, 2026
  14. melvin-bot commented on Jan 27, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  15. melvin-bot commented on Jan 27, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.9-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-02-03. 🎊

    For reference, here are some details about the assignees on this issue:

  16. melvin-bot commented on Jan 27, 2026

    @melvin-bot

    @ikevin127 @mallenexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  17. ikevin127 commented on Feb 2, 2026

    @ikevin127
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: N/A - Result of the original design

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/596691

    Regression Test Proposal

    1. Navigate to Account Settings > Profile > Contact Method > New Contact Method.
    2. Enter an email that already belongs to an existing user account.
    3. Click Add.
    4. Verify an error message is displayed indicating that the email already belongs to an existing account.

    Do we agree 👍 or 👎.

    Zapier Logs Run ID: 00040eee-9ff3-adc9-28be-1bc410a79034
  18. mallenexpensify commented on Feb 4, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @MobileMage paid $250 via Upwork
    Contributor+: @ikevin127 due $250 via NewDot

    ^ Test case created

    Thx!

  19. garrettmknight commented on Feb 10, 2026

    @garrettmknight
    Contributor

    $250 approved for @ikevin127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions