[$175] Connections - Error is being displayed when trying to Export a Report to Rillet
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: 9.5.31-0 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://github.com/Expensify/App/pull/104889 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: MacOs Tahoe / Safari 26.2 App Component: Other
Action Performed:
- Open https://staging.new.expensify.com/
- Navigate to Workspaces and select 'Connections'
- Locate Rillet and sign in using API key
- Click on 'Export' and select 'Export reimbursable expenses as Reimbursable'
- Now Create a new Report and fill it with an Expense
- Submit and Approve the Expense
- Click on 'More', select 'Export' and select 'Export to Rillet'
Expected Result:
No error should be displayed when exporting a Report to RIllet
Actual Result:
An error is displayed in Report Thread when trying to export to Rillet
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [x] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [x] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/f4cb474d-8f07-45a9-9f2f-051ba606766a
Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7304694
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022117951188645245533
- Upwork Job ID: 2117951188645245533
- Last Price Increase: 2026-11-04
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/789f9749f624734d37f9c4cc6a815bff6db5ec5baad845f84ca7e23361876b51
🤖 Web test steps verification results: ⚠️ partial
Verified on dev NewDot web. Rillet was located, but a paid Control-plan upgrade gate blocked connection; issue 105899 could not be reproduced.
| Step | Status |
|---|---|
Open AppAuthenticated Home screen rendered after onboarding. |
✅ |
Navigate Workspaces > ConnectionsConnections heading and integration list appeared. |
✅ |
Locate Rillet and connectRillet was listed, but selecting it displayed a Control-plan upgrade requirement. No API key was supplied.![]() |
⚠️ |
Configure Reimbursements export and inspect reimbursement accountBlocked by unavailable Rillet connection. |
⚠️ |
Create report with expenseNot attempted after the required integration fixture was blocked. |
⚠️ |
Submit and approveBlocked downstream. |
⚠️ |
Export to Rillet and inspect report-thread errorNo export or report-thread error verified. |
⚠️ |
⚠️ Preliminary analysis (low confidence) — treat as a starting point, not a conclusion.
A missing reimbursement account could explain the export failure, but the root cause is unconfirmed. Your reported steps omit account selection; the feature PR’s test steps require it.
Evidence and alternative explanation
Selecting Reimbursements saves the export mode without requiring an account (RilletReimbursablePage.tsx:48–53). A missing account triggers an admin warning, but does not block manual export (errors.ts:82–100, ReportSecondaryActionUtils.ts:555–592).
An unrelated export rejection could produce the same thread error (Report/index.ts:7158–7174). Omitted instructions do not prove the account was unset.
Web verification stopped at the Control-plan gate; no Rillet API key was available. Production logs were unavailable.
To confirm: Select an eligible reimbursement account, verify it persists after reloading, then retry export. Capture the exact thread error if it still fails. Compare against the missing-account case before choosing a fix.
Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk (External)
Job added to Upwork: https://www.upwork.com/jobs/~022117951188645245533
📣 @aion-citadel-forge! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ce254f013e8e6078
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Reviewing ASAP.
Proposal
What is the root cause of that problem?
In PR #104889 (Add Rillet reimbursements as an out-of-pocket export option), the ability to export reimbursable expenses as Reimbursements was introduced. However, two gaps in validation permit an invalid export state:
-
Premature Navigation without Account Selection in
RilletReimbursablePage.tsx: Insrc/pages/workspace/accounting/rillet/export/RilletReimbursablePage.tsx:const selectReimbursableExpensesExportDestination = (item: ReimbursableExpensesExportDestinationListItem) => { if (item.value !== exportReimbursable && policyID) { updateRilletReimbursableExpensesExportDestination(policyID, item.value, exportReimbursable); } Navigation.goBack(backPath); };When the user selects
CONST.RILLET_EXPORT_REIMBURSABLE.REIMBURSEMENT, the selection is saved and the screen immediately pops back toRilletExportPage. If the workspace has never selected a reimbursement account (rilletConfig?.export?.reimbursementAccountCodeisundefined), the configuration is left incomplete without forcing the user to pick an account. -
Unvalidated Export Invocation in
useExportActions.ts: Insrc/hooks/useExportActions.ts:202-211:onSelected: () => { if (!connectedIntegration || !moneyRequestReport) { return; } if (isExported) { triggerExportOrConfirm(CONST.REPORT.EXPORT_OPTIONS.EXPORT_TO_INTEGRATION); return; } exportToIntegration(moneyRequestReport.reportID, connectedIntegration, policy); },The hook only checks
!connectedIntegration(which returns'rillet'fromgetValidConnectedIntegration). It does not verify whether the connection has a missing destination account (shouldShowReimbursableExportDestinationAccountError(policy, [connectedIntegration])). WhenexportToIntegrationfiresAPI.write(WRITE_COMMANDS.REPORT_EXPORT, ...), the backend rejects the export becausereimbursementAccountCodeis missing, triggeringfailureDatainsrc/libs/actions/Report/index.ts:7084-7101and renderingcommon.genericErrorMessagein the report thread. -
Missing Subscribed Setting in
src/pages/workspace/accounting/utils.tsx: Insrc/pages/workspace/accounting/utils.tsx:524-533,exportSubscribedSettingsforCONST.POLICY.CONNECTIONS.NAME.RILLETincludesREIMBURSABLEbut is missingCONST.RILLET_CONFIG.REIMBURSEMENT_ACCOUNT_CODE.
What changes do you think we should make in order to solve the problem?
-
In
src/pages/workspace/accounting/rillet/export/RilletReimbursablePage.tsx: When the user selectsCONST.RILLET_EXPORT_REIMBURSABLE.REIMBURSEMENT:- If
!rilletConfig?.export?.reimbursementAccountCode, navigate directly toROUTES.POLICY_ACCOUNTING_RILLET_REIMBURSEMENT_ACCOUNT.getRoute(policyID)instead ofNavigation.goBack(backPath), ensuring the user selects a valid reimbursement account immediately. - If an account is already selected, return via
Navigation.goBack(backPath).
- If
-
In
src/hooks/useExportActions.ts: Before executingexportToIntegration, checkshouldShowReimbursableExportDestinationAccountError(policy, [connectedIntegration]):- If true, block the failing API write and navigate the user (or prompt via modal) to
ROUTES.POLICY_ACCOUNTING_RILLET_EXPORT.getRoute(policy.id)to configure the missing account, preventing an unhandled backend rejection.
- If true, block the failing API write and navigate the user (or prompt via modal) to
-
In
src/pages/workspace/accounting/utils.tsx: AddCONST.RILLET_CONFIG.REIMBURSEMENT_ACCOUNT_CODEtoexportSubscribedSettingsunderCONST.POLICY.CONNECTIONS.NAME.RILLETso that the Connections list displays the error brick road indicator when the required account is missing.
What alternative solutions did you explore? (Optional)
Only adding the check in useExportActions.ts: while this blocks the report action error, it still allows the user to leave the Rillet setup page in an invalid state. Guiding the user directly to RilletReimbursementAccountPage upon selecting Reimbursements fixes the issue at both the configuration layer and the export execution layer.
What automated tests can you add to prevent this from re-occurring?
- In
tests/unit/pages/workspace/accounting/rillet/RilletReimbursablePageTest.tsx:- Test that selecting
REIMBURSEMENTwhenreimbursementAccountCodeis unset navigates toROUTES.POLICY_ACCOUNTING_RILLET_REIMBURSEMENT_ACCOUNT. - Test that selecting
VENDOR_BILLor selectingREIMBURSEMENTwhen an account is already configured callsNavigation.goBack().
- Test that selecting
- In
tests/unit/useExportActionsTest.ts:- Test that
exportToIntegrationis not triggered and an error/navigation prompt is shown whenshouldShowReimbursableExportDestinationAccountErroris true.
- Test that
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
@brunovjk the steps here never pick a Reimbursement account, and the export fails without one. Can you check if that's the error here, or if it still fails with an account selected?
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace is connected to Rillet and the admin sets Export out-of-pocket expenses as to Reimbursements under Workspace > Accounting > Export without explicitly selecting a reimbursement liability account, attempting to export an approved report via More > Export > Export to Rillet fails and posts an export error message in the report thread.
What is the root cause of that problem?
In PR #104889 (src/pages/workspace/accounting/rillet/export/RilletReimbursablePage.tsx, lines 48–53), when the user selects Reimbursements (CONST.RILLET_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION.REIMBURSEMENTS), selectExportType calls updateRilletReimbursableExpensesExportDestination and immediately closes or updates the setting even when rilletConfig?.export?.reimbursableAccount is empty/unset!
When reimbursableAccount is unset, RilletReimbursablePage.tsx neither auto-selects the first available liability/payable account from rilletConfig as a default when switching to Reimbursements nor enforces selecting an account before leaving/exporting, so the backend receives an export request with reimbursableExpensesExportDestination = 'reimbursements' and an empty reimbursableAccount, which Rillet rejects.
What changes do you think we should make in order to solve the problem?
- In
src/pages/workspace/accounting/rillet/export/RilletReimbursablePage.tsx(andsrc/libs/actions/connections/Rillet.ts):- When the user switches
reimbursableExpensesExportDestinationtoCONST.RILLET_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION.REIMBURSEMENTSandreimbursableAccountis currently empty, automatically defaultreimbursableAccountto the first valid account in the Rillet reimbursable accounts list (matching how Xero/NetSuite/QuickBooks Online export pages default their account selector when switching export modes), or keep the user onRilletReimbursablePagewith the account selector visible rather than callingNavigation.goBack().
- When the user switches
- In
src/pages/workspace/accounting/rillet/export/RilletExportPage.tsxandRilletReimbursablePage.tsx, display a Red Brick Road (RBR) indicator / error message ifreimbursableExpensesExportDestination === CONST.RILLET_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION.REIMBURSEMENTSand noreimbursableAccountis selected.
What alternative solutions did you explore? (Optional)
We considered blocking the Export to Rillet button in the report header when reimbursableAccount is empty, but auto-defaulting reimbursableAccount to the first available account when selecting Reimbursements in RilletReimbursablePage.tsx (and not auto-closing the page before the user can see/confirm the account row) prevents the misconfiguration from happening in the first place.
📣 @jeffrey-graham! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Proposal
Please re-state the problem that we are trying to solve in this issue.
After connecting a workspace to Rillet and setting Export reimbursable expenses as to Reimbursement (CONST.RILLET_EXPORT_REIMBURSABLE.REIMBURSEMENT), exporting an approved expense report via More > Export > Export to Rillet fails and posts an export error in the report thread.
What is the root cause of that problem?
In PR #104889 (src/pages/workspace/accounting/rillet/export/RilletReimbursablePage.tsx:48-53 and src/libs/actions/connections/Rillet.ts:649-656), when the admin switches rilletConfig.export.reimbursable from vendor_bill to reimbursement, updateRilletReimbursableExpensesExportDestination only updates config.export.reimbursable without initializing config.export.reimbursementAccountCode (which remains undefined), and RilletReimbursablePage.tsx immediately calls Navigation.goBack(backPath).
Let's compare this with how RilletReimbursementAccountPage.tsx:44-59 filters valid reimbursement accounts from rilletData?.accounts:
accountItem.type === CONST.RILLET_ACCOUNT_TYPE.LIABILITY &&
accountItem.subtype !== CONST.RILLET_ACCOUNT_SUBTYPE.CREDIT_CARD &&
accountItem.subtype !== CONST.RILLET_ACCOUNT_SUBTYPE.ACCOUNTS_PAYABLE &&
accountItem.subtype !== CONST.RILLET_ACCOUNT_SUBTYPE.OTHER_LONG_TERM_LIABILITY &&
accountItem.status === CONST.RILLET_ACCOUNT_STATUS.ACTIVE
Because RilletReimbursablePage.tsx pops straight back to RilletExportPage without either auto-selecting a default valid reimbursement liability account or navigating to ROUTES.POLICY_ACCOUNTING_RILLET_REIMBURSEMENT_ACCOUNT.getRoute(policyID) when reimbursementAccountCode is missing, and because useExportActions.ts:203-212 triggers exportToIntegration(moneyRequestReport.reportID, connectedIntegration, policy) without checking shouldShowReimbursableExportDestinationAccountError(policy, [connectedIntegration]), the export API request is sent to the backend with no reimbursementAccountCode configured and fails in the report thread.
What changes do you think we should make in order to solve the problem?
- Auto-default or route to account selection in
src/pages/workspace/accounting/rillet/export/RilletReimbursablePage.tsx:48-53:- Extract the eligible reimbursement accounts filter (
getRilletReimbursementAccounts(rilletData?.accounts)) shared withRilletReimbursementAccountPage.tsx. - When the user selects
CONST.RILLET_EXPORT_REIMBURSABLE.REIMBURSEMENTand!rilletConfig?.export?.reimbursementAccountCode:- If eligible reimbursement accounts exist in
rilletData?.accounts, either defaultreimbursementAccountCodeto the first eligible account (updateRilletReimbursementAccount(policyID, defaultAccount.code, undefined)) or navigate directly toROUTES.POLICY_ACCOUNTING_RILLET_REIMBURSEMENT_ACCOUNT.getRoute(policyID)soreimbursementAccountCodeis never left unset.
- If eligible reimbursement accounts exist in
- Extract the eligible reimbursement accounts filter (
// src/pages/workspace/accounting/rillet/export/RilletReimbursablePage.tsx
const selectReimbursableExpensesExportDestination = (item: ReimbursableExpensesExportDestinationListItem) => {
if (item.value !== exportReimbursable && policyID) {
updateRilletReimbursableExpensesExportDestination(policyID, item.value, exportReimbursable);
if (item.value === CONST.RILLET_EXPORT_REIMBURSABLE.REIMBURSEMENT && !rilletConfig?.export?.reimbursementAccountCode) {
Navigation.navigate(ROUTES.POLICY_ACCOUNTING_RILLET_REIMBURSEMENT_ACCOUNT.getRoute(policyID));
return;
}
}
Navigation.goBack(backPath);
};
- Also auto-populate a default
reimbursementAccountCodeinupdateRilletReimbursableExpensesExportDestination(src/libs/actions/connections/Rillet.ts:649-656) when available:- When switching to
CONST.RILLET_EXPORT_REIMBURSABLE.REIMBURSEMENTandreimbursementAccountCodeis unset while an active short-term liability account exists inpolicy.connections.rillet.data.accounts, set the defaultreimbursementAccountCodeso QA/users who selectReimbursementand immediately export have a valid account code configured.
- When switching to
What alternative solutions did you explore? (Optional)
We considered only showing a Red Brick Road indicator on RilletExportPage.tsx (which already checks shouldShowReimbursableExportDestinationAccountError at line 103), but in the reported QA flow the user selects Export reimbursable expenses as Reimbursable and goes straight to creating and exporting a report without selecting Reimbursement account. Defaulting reimbursementAccountCode when available (and routing to RilletReimbursementAccountPage when manual selection is needed) prevents the unconfigured export error.
📣 @ronanchnlps-bit! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
- Make sure you've read and understood the contributing guidelines.
- Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
- Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
- Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.
:warning: Unable to store contributor details
Details
Auth SetContributorDetails returned an error 401 Contributor details already exist