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] Expense - Tax amount changes to zero after creating negative expense with non-zero tax rate #83087
Please re-state the problem that we are trying to solve in this issue.
When creating a negative expense (e.g., -$5.00) with a non-zero tax rate (e.g., 5%), the tax amount displays correctly on the confirmation page but becomes zero after the expense is created.
What is the root cause of that problem?
The root cause is in MoneyRequestConfirmationList.tsx at line 545, where the taxableAmount is set to the raw transaction?.amount without taking the absolute value:
For a negative expense (e.g., -$5.00), transaction.amount is -500 (in smallest currency units). This negative value is passed to calculateTaxAmount (TransactionUtils/index.ts:2025-2033), which preserves the sign, producing a negative tax amount (e.g., -0.24 for 5% tax). This negative tax gets stored on the draft transaction via setMoneyRequestTaxAmount at line 558.
The confirmation page appears to show the correct tax because the display function getTaxAmount (TransactionUtils/index.ts:937-941) applies Math.abs before displaying — this masks the underlying negative value.
When the user confirms, IOURequestStepConfirmation.tsx reads the raw negative taxAmount from the draft (line 274) and passes it directly to requestMoney, which sends the negative value to the backend API (IOU/index.ts:6756). The backend likely interprets the negative tax amount as zero or invalid.
Notably, the tax rate page (IOURequestStepTaxRatePage.tsx:82) handles this correctly by using getAmount(currentTransaction, false, true) which returns a positive value, but the MoneyRequestConfirmationList useEffect then overwrites this correct value with its own negative calculation when the confirmation page renders.
What changes do you think we should make in order to solve the problem?
In src/components/MoneyRequestConfirmationList.tsx at line 545, wrap the non-distance taxable amount in Math.abs:
This ensures calculateTaxAmount always receives a positive amount, producing a positive tax value that correctly flows through the rest of the creation pipeline.
What alternative solutions did you explore? (Optional)
Fix at IOURequestStepConfirmation.tsx:274 — Apply Math.abs when reading transactionTaxAmount. This would work but is a downstream band-aid; it's better to fix the calculation at the source so the draft always stores the correct positive tax value.
Fix inside calculateTaxAmount — Make it always return Math.abs of its result. This would work but changes the function's general contract; the current sign-preserving behavior may be intentional for other callers.
Fix at IOU/index.ts:3522 — Apply Math.abs in getMoneyRequestInformation when building the optimistic transaction. This would partially work (for expense reports, the double-negation already accidentally produces the correct value), but wouldn't fix the underlying incorrect draft value.
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 [-]Expense - Tax amount changes to zero after creating negative expense with non-zero tax rate[/-][+][$250] Expense - Tax amount changes to zero after creating negative expense with non-zero tax rate[/+]on Feb 20, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-02-20 18:36:40 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a negative manual expense (for example, -$5.00) with a non-zero tax rate (for example, 5%), tax appears non-zero on confirmation, but after creating the expense the final tax becomes 0.
What is the root cause of that problem?
The confirmation flow was calculating tax from a signed transaction amount, so negative expenses produced a negative tax value internally.
What changes do you think we should make in order to solve the problem?
Use normalized IOU amount (getAmount) when calculating non-distance taxable amount in confirmation, so tax is always computed from a positive base for manual IOU requests.
This is the correct source-level fix because getAmount already enforces IOU sign normalization for this flow
Add regression coverage for negative manual expenses with tax:
Please re-state the problem that we are trying to solve in this issue.
Tax amount changes to zero after creating negative expense with non-zero tax rate.
What is the root cause of that problem?
On the confirm page, tax is computed correctly for negative amounts: MoneyRequestConfirmationList uses transaction?.amount (negative) with calculateTaxAmount, so the draft gets a negative tax amount and the UI shows the correct non-zero tax.
When the user taps Create expense, the TRACK_EXPENSE API is called with taxAmount from the draft (a negative number for negative expenses). The backend likely expects a positive tax amount and either rejects or zeroes negative tax, so the stored transaction is returned with taxAmount: 0. The client then shows zero tax when the expense is opened.
Relevant flow:
Confirm page passes transaction?.taxAmount (negative) into track expense:
Optimistic transaction is built with taxAmount: taxAmount ? -taxAmount : undefined (so a negative draft tax becomes positive in the stored transaction), but the server response overwrites the transaction with the backend value (taxAmount: 0):
What changes do you think we should make in order to solve the problem?
Send the tax amount as an absolute value in the TRACK_EXPENSE API request so the backend receives a positive value and can persist it. The client already applies the correct sign for display in expense report context via getTaxAmount(transaction, isFromExpenseReport) in TransactionUtils, which returns the negated value for expense reports, so the displayed tax will remain correct.
⚠️@btkcodedev Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
[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: Not Required. The existing checklist is good enough to capture such issues.
[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.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
melvin-bot commentedon Feb 20, 2026
Triggered auto assignment to @CortneyOfstad (
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 20, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a negative expense (e.g., -$5.00) with a non-zero tax rate (e.g., 5%), the tax amount displays correctly on the confirmation page but becomes zero after the expense is created.
What is the root cause of that problem?
The root cause is in
MoneyRequestConfirmationList.tsxat line 545, where thetaxableAmountis set to the rawtransaction?.amountwithout taking the absolute value:For a negative expense (e.g., -$5.00),
transaction.amountis-500(in smallest currency units). This negative value is passed tocalculateTaxAmount(TransactionUtils/index.ts:2025-2033), which preserves the sign, producing a negative tax amount (e.g.,-0.24for 5% tax). This negative tax gets stored on the draft transaction viasetMoneyRequestTaxAmountat line 558.The confirmation page appears to show the correct tax because the display function
getTaxAmount(TransactionUtils/index.ts:937-941) appliesMath.absbefore displaying — this masks the underlying negative value.When the user confirms,
IOURequestStepConfirmation.tsxreads the raw negativetaxAmountfrom the draft (line 274) and passes it directly torequestMoney, which sends the negative value to the backend API (IOU/index.ts:6756). The backend likely interprets the negative tax amount as zero or invalid.Notably, the tax rate page (
IOURequestStepTaxRatePage.tsx:82) handles this correctly by usinggetAmount(currentTransaction, false, true)which returns a positive value, but theMoneyRequestConfirmationListuseEffect then overwrites this correct value with its own negative calculation when the confirmation page renders.What changes do you think we should make in order to solve the problem?
In
src/components/MoneyRequestConfirmationList.tsxat line 545, wrap the non-distance taxable amount inMath.abs:This ensures
calculateTaxAmountalways receives a positive amount, producing a positive tax value that correctly flows through the rest of the creation pipeline.What alternative solutions did you explore? (Optional)
Fix at
IOURequestStepConfirmation.tsx:274— ApplyMath.abswhen readingtransactionTaxAmount. This would work but is a downstream band-aid; it's better to fix the calculation at the source so the draft always stores the correct positive tax value.Fix inside
calculateTaxAmount— Make it always returnMath.absof its result. This would work but changes the function's general contract; the current sign-preserving behavior may be intentional for other callers.Fix at
IOU/index.ts:3522— ApplyMath.absingetMoneyRequestInformationwhen building the optimistic transaction. This would partially work (for expense reports, the double-negation already accidentally produces the correct value), but wouldn't fix the underlying incorrect draft value.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 20, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (
External)[-]Expense - Tax amount changes to zero after creating negative expense with non-zero tax rate[/-][+][$250] Expense - Tax amount changes to zero after creating negative expense with non-zero tax rate[/+]melvin-bot commentedon Feb 20, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022024903783911413849
btkcodedev commentedon Feb 20, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-02-20 18:36:40 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a negative manual expense (for example,
-$5.00) with a non-zero tax rate (for example,5%), tax appears non-zero on confirmation, but after creating the expense the final tax becomes0.What is the root cause of that problem?
The confirmation flow was calculating tax from a signed transaction amount, so negative expenses produced a negative tax value internally.
What changes do you think we should make in order to solve the problem?
Use normalized IOU amount (
getAmount) when calculating non-distance taxable amount in confirmation, so tax is always computed from a positive base for manual IOU requests.[~/App/src/components/MoneyRequestConfirmationList.tsx:546]
This is the correct source-level fix because
getAmountalready enforces IOU sign normalization for this flowAdd regression coverage for negative manual expenses with tax:
[~/App/tests/ui/components/IOURequestStepConfirmationPageTest.tsx:357]
What alternative solutions did you explore? (Optional)
None
abbasifaizan70 commentedon Feb 20, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Tax amount changes to zero after creating negative expense with non-zero tax rate.
What is the root cause of that problem?
On the confirm page, tax is computed correctly for negative amounts:
MoneyRequestConfirmationListusestransaction?.amount(negative) withcalculateTaxAmount, so the draft gets a negative tax amount and the UI shows the correct non-zero tax.When the user taps Create expense, the TRACK_EXPENSE API is called with
taxAmountfrom the draft (a negative number for negative expenses). The backend likely expects a positive tax amount and either rejects or zeroes negative tax, so the stored transaction is returned withtaxAmount: 0. The client then shows zero tax when the expense is opened.Relevant flow:
transaction?.taxAmount(negative) into track expense:App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Line 274 in a8f2d3a
App/src/libs/actions/IOU/index.ts
Lines 7647 to 7649 in a8f2d3a
taxAmount: taxAmount ? -taxAmount : undefined(so a negative draft tax becomes positive in the stored transaction), but the server response overwrites the transaction with the backend value (taxAmount: 0):App/src/libs/actions/IOU/index.ts
Lines 4288 to 4291 in a8f2d3a
What changes do you think we should make in order to solve the problem?
Send the tax amount as an absolute value in the TRACK_EXPENSE API request so the backend receives a positive value and can persist it. The client already applies the correct sign for display in expense report context via
getTaxAmount(transaction, isFromExpenseReport)inTransactionUtils, which returns the negated value for expense reports, so the displayed tax will remain correct.File:
App/src/libs/actions/IOU/index.tsconst parameters: TrackExpenseParams = { amount, attendees: attendees ? JSON.stringify(attendees) : undefined, currency, comment, distance: distance !== undefined ? roundToTwoDecimalPlaces(distance) : undefined, created, merchant, iouReportID: iouReport?.reportID, chatReportID: optimisticReportID ? undefined : chatReport?.reportID, transactionID: transaction?.transactionID, reportActionID: iouAction?.reportActionID, createdChatReportActionID, createdIOUReportActionID, reportPreviewReportActionID: reportPreviewAction?.reportActionID, optimisticReportID, optimisticReportActionID, policyID: undefined, receipt: isFileUploadable(trackedReceipt) ? trackedReceipt : undefined, receiptState: trackedReceipt?.state, reimbursable, category, tag, taxCode, - taxAmount, + taxAmount: Math.abs(taxAmount ?? 0), billable, receiptGpsPoints: gpsPoint ? JSON.stringify(gpsPoint) : undefined, transactionThreadReportID, createdReportActionIDForThread, waypoints: sanitizedWaypoints, customUnitRateID, description: parsedComment, gpsCoordinates, isDistance: isGPSDistanceRequest || isMapDistanceRequest(transaction) || isManualDistanceRequestTransactionUtils(transaction), };github-actions commentedon Feb 20, 2026
11 remaining items
rojiphil commentedon Feb 27, 2026
Melvin's proposal LGTM.
🎀👀🎀 C+ reviewed
melvin-bot commentedon Feb 27, 2026
Triggered auto assignment to @inimaga, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
inimaga commentedon Feb 27, 2026
Now merged.
Fix bug preventing manual adjustment of tax amount
rojiphil commentedon Mar 16, 2026
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
[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: Not Required. The existing checklist is good enough to capture such issues.
[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/612568
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-311c-aab8-33ea-b5f9e479d894mallenexpensify commentedon Mar 16, 2026
Payment Summary
Contributor+: @rojiphil due $250 via NewDot
^ Test case created
thx
quinthar commentedon Apr 13, 2026
Approved $250 to @rojiphil