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
[$250] Travel - Error show when toogle on the Travel Invoicing on the 2nd Workspace #83549
Version Number: v9.3.26-4 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#83248 Email or phone of affected tester (no customers):applausetester+vq+2502@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Pixel 7 Pro /Android 16 App Component: Workspace Settings
Action Performed:
Precondition: User is not in a country with the default USD currency; use the Expensifail account
Create a workspace that has an Expensify Card with a Settlement Bank Account but no Travel Invoicing configured
Navigate to the Travel page for that workspace (toggle is disabled by default)
Create a 2nd workspace
Go to More features -> toggle on Travel
Go to Travel page -> Let's go -> enter address -> Save -> Continue
Go back to the App
Toggle on the Travel Invoicing -> Select the bank account Plaid xxx1111
Go to the Overview ( currency row is disabled)
Return to the Travel page -> toggle on the Travel Invoicing again
Expected Result:
Verify that the toggle correctly shows the enabled state
Actual Result:
After toggling on the Travel Invoicing on the 2nd Workspace, it auto toggles off, and an error appears: "Travel invoicing is not configured. Please set up a USD settlement account first" and can't change the currency in the Overview: "The default currency can't be changed because this workspace is linked to a VND bank account."
Please re-state the problem that we are trying to solve in this issue.
On a workspace created by a non-USD country user (e.g. VND), when the user enables Travel and toggles on Travel Invoicing by selecting a bank account, the toggle auto-reverts to OFF and an error appears: "Travel invoicing is not configured. Please set up a USD settlement account first." Additionally, the Overview page locks the currency field with a misleading message: "The default currency can't be changed because this workspace is linked to a VND bank account" — even though the bank account selected may actually be a USD account.
What is the root cause of that problem?
There are two contributing issues:
1. No currency validation on the frontend for Travel Invoicing bank account selection
When selecting a settlement account for Travel Invoicing, the bank account list is populated by getEligibleBankAccountsForCard() at src/libs/CardUtils.ts:363-368, which only filters by type === BUSINESS && allowDebit — it performs no currency check. The bank account list comes from the global BANK_ACCOUNT_LIST Onyx key (not per-workspace), so all of the user's business bank accounts appear regardless of currency.
The backend's ToggleTravelInvoicing command requires a valid USD settlement account for the Travel program. When a non-USD workspace attempts to enable Travel Invoicing, the backend rejects it and returns the error in onyxData, which is then applied to cardSettings.errors and displayed under the toggle.
2. Race condition between settlement account and toggle API calls
setTravelInvoicingSettlementAccount(...) — sets the bank account
toggleTravelInvoicing(...) — enables the toggle
If the toggle command reaches the backend before the settlement account is fully saved, the backend won't see a settlement account and will reject the toggle. This contributes to the first toggle attempt failing.
3. Misleading currency message on Overview page
The currency disabled text at src/pages/workspace/WorkspaceOverviewPage.tsx:704-705 uses policy.outputCurrency (the workspace's own currency, e.g. VND) rather than the actual bank account's currency. The message says "linked to a VND bank account" when the bank account may actually be USD — the currencyInputDisabledText template at src/languages/en.ts:5998 just inserts whatever workspace currency is passed.
What changes do you think we should make in order to solve the problem?
Add USD currency filtering for Travel Invoicing bank account selection: Create a travel-specific bank account filter (or extend getEligibleBankAccountsForCard) that only shows USD bank accounts when selecting a settlement account for Travel Invoicing. Apply this filter in WorkspaceTravelInvoicingSettlementAccountPage.tsx and in WorkspaceTravelInvoicingSection.tsx's handleToggle eligibility check.
Fix the race condition: In WorkspaceTravelInvoicingSettlementAccountPage.tsx, ensure the toggle call only fires after the settlement account API call succeeds — either by chaining them (using successData to trigger the toggle) or by moving the toggle enablement to a callback/effect that runs after settlement account confirmation.
Fix the misleading currency message: In WorkspaceOverviewPage.tsx, when displaying currencyInputDisabledText, look up the actual bank account's currency from bankAccountsList using the paymentBankAccountID instead of using policy.outputCurrency.
What alternative solutions did you explore? (Optional)
Block Travel Invoicing entirely for non-USD workspaces: Add a frontend guard in handleToggle that checks policy.outputCurrency === 'USD' before allowing the toggle. This is simpler but more restrictive — it prevents users from enabling Travel Invoicing even if they have a valid USD bank account and intend to change their workspace currency.
Backend-only fix: Improve the backend error messaging to be more descriptive about exactly what's wrong (e.g., "This workspace's currency must be USD for Travel Invoicing" vs "the bank account must be USD"). However, this alone wouldn't prevent the poor UX of the toggle auto-reverting.
Detailed Investigation
Evidence Chain
Toggle flow: User toggles ON → handleToggle in WorkspaceTravelInvoicingSection.tsx:117-158 checks eligibility → navigates to settlement account page if needed → user selects bank account → handleSelectAccount at WorkspaceTravelInvoicingSettlementAccountPage.tsx:61-78 fires both setTravelInvoicingSettlementAccount and toggleTravelInvoicing simultaneously.
Optimistic update: toggleTravelInvoicing at TravelInvoicing.ts:249-301 optimistically sets isEnabled=true and TRAVEL_US.isEnabled=true, clears errors. Toggle appears ON in the UI.
Backend rejection: Backend returns non-200 jsonCode with onyxData containing {errors: {"Travel invoicing is not configured..."}} merged into PRIVATE_EXPENSIFY_CARD_SETTINGS_{workspaceAccountID}.
Response processing: Per OnyxUpdates.ts:49-74, backend onyxData (with errors) is applied first, then client failureData reverts isEnabled to false. Toggle flips back to OFF and error message appears.
Currency lock: setTravelInvoicingSettlementAccount optimistically writes paymentBankAccountID at root level (TravelInvoicing.ts:81). On WorkspaceOverviewPage.tsx:98-100, isBankAccountVerified = !!cardSettings?.paymentBankAccountID becomes true. The currency field is disabled with currencyInputDisabledText(policyCurrency) where policyCurrency = policy.outputCurrency = 'VND'.
Second toggle attempt: User returns to Travel page → toggle is OFF (failureData reverted it) → TRAVEL_US still exists from the failed toggle attempt → hasSettlementAccount is true → handleToggle calls toggleTravelInvoicing directly → backend rejects again (confirming this is not just a race condition but a fundamental validation failure for non-USD workspaces).
This bug was caught during QA of PR #83248, which tightened getTravelSettings() to require TRAVEL_US presence. That PR fixed a separate bug (#83038) where root-level Expensify Card settings were being misinterpreted as Travel Invoicing settings. PR #83248 is not the cause of this bug — the underlying issue (no USD currency validation and the race condition) existed before that PR.
Relevant Code
src/libs/CardUtils.ts:363-368 — getEligibleBankAccountsForCard with no currency filter
src/pages/workspace/travel/WorkspaceTravelInvoicingSettlementAccountPage.tsx:61-78 — Race condition site
src/pages/workspace/travel/WorkspaceTravelInvoicingSection.tsx:105,117-158 — Toggle handler and eligibility check
changed the title [-]Travel - Error show when toogle on the Travel Invoicing on the 2nd Workspace[/-][+][$250] Travel - Error show when toogle on the Travel Invoicing on the 2nd Workspace[/+]on Feb 26, 2026
Please re-state the problem that we are trying to solve in this issue.
After toggling on the Travel Invoicing on the 2nd Workspace, it auto toggles off, and an error appears: "Travel invoicing is not configured. Please set up a USD settlement account first" and can't change the currency in the Overview: "The default currency can't be changed because this workspace is linked to a VND bank account."
Travel Invoicing (PROGRAM_TRAVEL_US) requires a USD settlement account, but the frontend shows all business bank accounts regardless of currency. When a non-USD account is selected, the backend correctly rejects the toggle, causing it to auto-revert. Additionally, the optimistic paymentBankAccountID set by setTravelInvoicingSettlementAccount at the root level of cardSettings persists even after the toggle failure (the failureData only reverts isEnabled), causing the Overview page to lock the currency field with a misleading message using policy.outputCurrency (VND) instead of the actual bank account currency.
What changes do you think we should make in order to solve the problem?
Add a new getEligibleBankAccountsForTravelInvoicing() function in CardUtils.ts that filters by bankCurrency === USD, following the existing getEligibleBankAccountsForUkEuCard pattern. Then replace getEligibleBankAccountsForCard with this new function in both Travel Invoicing files.
In src/pages/workspace/travel/WorkspaceTravelInvoicingSettlementAccountPage.tsx:
-import {getEligibleBankAccountsForCard} from '@libs/CardUtils';+import {getEligibleBankAccountsForTravelInvoicing} from '@libs/CardUtils';- const eligibleBankAccounts = getEligibleBankAccountsForCard(bankAccountsList);+ const eligibleBankAccounts = getEligibleBankAccountsForTravelInvoicing(bankAccountsList);
In src/pages/workspace/travel/WorkspaceTravelInvoicingSection.tsx:
-import {getEligibleBankAccountsForCard} from '@libs/CardUtils';+import {getEligibleBankAccountsForTravelInvoicing} from '@libs/CardUtils';- const eligibleBankAccounts = getEligibleBankAccountsForCard(bankAccountList);+ const eligibleBankAccounts = getEligibleBankAccountsForTravelInvoicing(bankAccountList);
What alternative solutions did you explore? (Optional)
Add an optional currency parameter to the existing getEligibleBankAccountsForCard(). However, a separate function follows the existing pattern (see getEligibleBankAccountsForUkEuCard) and avoids affecting other callers.
Activity
melvin-bot commentedon Feb 26, 2026
Triggered auto assignment to @johncschuster (
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 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On a workspace created by a non-USD country user (e.g. VND), when the user enables Travel and toggles on Travel Invoicing by selecting a bank account, the toggle auto-reverts to OFF and an error appears: "Travel invoicing is not configured. Please set up a USD settlement account first." Additionally, the Overview page locks the currency field with a misleading message: "The default currency can't be changed because this workspace is linked to a VND bank account" — even though the bank account selected may actually be a USD account.
What is the root cause of that problem?
There are two contributing issues:
1. No currency validation on the frontend for Travel Invoicing bank account selection
When selecting a settlement account for Travel Invoicing, the bank account list is populated by
getEligibleBankAccountsForCard()atsrc/libs/CardUtils.ts:363-368, which only filters bytype === BUSINESS && allowDebit— it performs no currency check. The bank account list comes from the globalBANK_ACCOUNT_LISTOnyx key (not per-workspace), so all of the user's business bank accounts appear regardless of currency.The backend's
ToggleTravelInvoicingcommand requires a valid USD settlement account for the Travel program. When a non-USD workspace attempts to enable Travel Invoicing, the backend rejects it and returns the error inonyxData, which is then applied tocardSettings.errorsand displayed under the toggle.2. Race condition between settlement account and toggle API calls
In
src/pages/workspace/travel/WorkspaceTravelInvoicingSettlementAccountPage.tsx:69-74, when a user selects a bank account, twoAPI.writecalls fire back-to-back without awaiting:setTravelInvoicingSettlementAccount(...)— sets the bank accounttoggleTravelInvoicing(...)— enables the toggleIf the toggle command reaches the backend before the settlement account is fully saved, the backend won't see a settlement account and will reject the toggle. This contributes to the first toggle attempt failing.
3. Misleading currency message on Overview page
The currency disabled text at
src/pages/workspace/WorkspaceOverviewPage.tsx:704-705usespolicy.outputCurrency(the workspace's own currency, e.g. VND) rather than the actual bank account's currency. The message says "linked to a VND bank account" when the bank account may actually be USD — thecurrencyInputDisabledTexttemplate atsrc/languages/en.ts:5998just inserts whatever workspace currency is passed.What changes do you think we should make in order to solve the problem?
Add USD currency filtering for Travel Invoicing bank account selection: Create a travel-specific bank account filter (or extend
getEligibleBankAccountsForCard) that only shows USD bank accounts when selecting a settlement account for Travel Invoicing. Apply this filter inWorkspaceTravelInvoicingSettlementAccountPage.tsxand inWorkspaceTravelInvoicingSection.tsx'shandleToggleeligibility check.Fix the race condition: In
WorkspaceTravelInvoicingSettlementAccountPage.tsx, ensure the toggle call only fires after the settlement account API call succeeds — either by chaining them (usingsuccessDatato trigger the toggle) or by moving the toggle enablement to a callback/effect that runs after settlement account confirmation.Fix the misleading currency message: In
WorkspaceOverviewPage.tsx, when displayingcurrencyInputDisabledText, look up the actual bank account's currency frombankAccountsListusing thepaymentBankAccountIDinstead of usingpolicy.outputCurrency.What alternative solutions did you explore? (Optional)
Block Travel Invoicing entirely for non-USD workspaces: Add a frontend guard in
handleTogglethat checkspolicy.outputCurrency === 'USD'before allowing the toggle. This is simpler but more restrictive — it prevents users from enabling Travel Invoicing even if they have a valid USD bank account and intend to change their workspace currency.Backend-only fix: Improve the backend error messaging to be more descriptive about exactly what's wrong (e.g., "This workspace's currency must be USD for Travel Invoicing" vs "the bank account must be USD"). However, this alone wouldn't prevent the poor UX of the toggle auto-reverting.
Detailed Investigation
Evidence Chain
Toggle flow: User toggles ON →
handleToggleinWorkspaceTravelInvoicingSection.tsx:117-158checks eligibility → navigates to settlement account page if needed → user selects bank account →handleSelectAccountatWorkspaceTravelInvoicingSettlementAccountPage.tsx:61-78fires bothsetTravelInvoicingSettlementAccountandtoggleTravelInvoicingsimultaneously.Optimistic update:
toggleTravelInvoicingatTravelInvoicing.ts:249-301optimistically setsisEnabled=trueandTRAVEL_US.isEnabled=true, clears errors. Toggle appears ON in the UI.Backend rejection: Backend returns non-200
jsonCodewithonyxDatacontaining{errors: {"Travel invoicing is not configured..."}}merged intoPRIVATE_EXPENSIFY_CARD_SETTINGS_{workspaceAccountID}.Response processing: Per
OnyxUpdates.ts:49-74, backendonyxData(with errors) is applied first, then clientfailureDatarevertsisEnabledtofalse. Toggle flips back to OFF and error message appears.Currency lock:
setTravelInvoicingSettlementAccountoptimistically writespaymentBankAccountIDat root level (TravelInvoicing.ts:81). OnWorkspaceOverviewPage.tsx:98-100,isBankAccountVerified = !!cardSettings?.paymentBankAccountIDbecomes true. The currency field is disabled withcurrencyInputDisabledText(policyCurrency)wherepolicyCurrency = policy.outputCurrency = 'VND'.Second toggle attempt: User returns to Travel page → toggle is OFF (failureData reverted it) →
TRAVEL_USstill exists from the failed toggle attempt →hasSettlementAccountis true →handleTogglecallstoggleTravelInvoicingdirectly → backend rejects again (confirming this is not just a race condition but a fundamental validation failure for non-USD workspaces).Context: PR #83248
This bug was caught during QA of PR #83248, which tightened
getTravelSettings()to requireTRAVEL_USpresence. That PR fixed a separate bug (#83038) where root-level Expensify Card settings were being misinterpreted as Travel Invoicing settings. PR #83248 is not the cause of this bug — the underlying issue (no USD currency validation and the race condition) existed before that PR.Relevant Code
src/libs/CardUtils.ts:363-368—getEligibleBankAccountsForCardwith no currency filtersrc/pages/workspace/travel/WorkspaceTravelInvoicingSettlementAccountPage.tsx:61-78— Race condition sitesrc/pages/workspace/travel/WorkspaceTravelInvoicingSection.tsx:105,117-158— Toggle handler and eligibility checksrc/libs/actions/TravelInvoicing.ts:58-139—setTravelInvoicingSettlementAccount(root-level write)src/libs/actions/TravelInvoicing.ts:249-301—toggleTravelInvoicing(optimistic/failure data)src/pages/workspace/WorkspaceOverviewPage.tsx:169,704-705— Misleading currency messagesrc/languages/en.ts:5998—currencyInputDisabledTexttemplateNext 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 26, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ShridharGoel (
External)melvin-bot commentedon Feb 26, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022026962151597239271
[-]Travel - Error show when toogle on the Travel Invoicing on the 2nd Workspace[/-][+][$250] Travel - Error show when toogle on the Travel Invoicing on the 2nd Workspace[/+]daledah commentedon Feb 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
After toggling on the Travel Invoicing on the 2nd Workspace, it auto toggles off, and an error appears: "Travel invoicing is not configured. Please set up a USD settlement account first" and can't change the currency in the Overview: "The default currency can't be changed because this workspace is linked to a VND bank account."
What is the root cause of that problem?
The settlement account selector in
WorkspaceTravelInvoicingSettlementAccountPageand the toggle handler inWorkspaceTravelInvoicingSectionboth usegetEligibleBankAccountsForCard()to populate the bank account list. This function only filters bytype === BUSINESS && allowDebit— it does not check currency.App/src/pages/workspace/travel/WorkspaceTravelInvoicingSettlementAccountPage.tsx
Line 42 in a152afa
(
App/src/pages/workspace/travel/WorkspaceTravelInvoicingSection.tsx
Line 105 in a152afa
Travel Invoicing (
PROGRAM_TRAVEL_US) requires a USD settlement account, but the frontend shows all business bank accounts regardless of currency. When a non-USD account is selected, the backend correctly rejects the toggle, causing it to auto-revert. Additionally, the optimisticpaymentBankAccountIDset bysetTravelInvoicingSettlementAccountat the root level ofcardSettingspersists even after the toggle failure (thefailureDataonly revertsisEnabled), causing the Overview page to lock the currency field with a misleading message usingpolicy.outputCurrency(VND) instead of the actual bank account currency.What changes do you think we should make in order to solve the problem?
Add a new
getEligibleBankAccountsForTravelInvoicing()function inCardUtils.tsthat filters bybankCurrency === USD, following the existinggetEligibleBankAccountsForUkEuCardpattern. Then replacegetEligibleBankAccountsForCardwith this new function in both Travel Invoicing files.In
src/libs/CardUtils.ts:In
src/pages/workspace/travel/WorkspaceTravelInvoicingSettlementAccountPage.tsx:In
src/pages/workspace/travel/WorkspaceTravelInvoicingSection.tsx:What alternative solutions did you explore? (Optional)
Add an optional
currencyparameter to the existinggetEligibleBankAccountsForCard(). However, a separate function follows the existing pattern (seegetEligibleBankAccountsForUkEuCard) and avoids affecting other callers.rlinoz commentedon Feb 26, 2026
I believe this is being solved by another PR cc: @blimpich
I will also re-assign because this is part of the travel invoicing project.
blimpich commentedon Feb 26, 2026
Yeah this will be solved by the 1:1:1 work I'm doing here: #81470. Closing this since this is (A) being handled elsewhere and (B) is behind a beta