Skip to content

[$250] Expense - Rate not valid error is not shown after deleting per diem rate #82584

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: V9.3.20-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: #82288
Email or phone of affected tester (no customers): dreamnitethedragon@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Redminote 10S Android 13
App Component: Money Requests

Action Performed:

Pre-condition: Have a workspace with per diem rate imported

  1. Launch app
  2. Create a per diem expense ( Afganistan, qty 6, breakfast)
  3. Delete the rate used in step 2
  4. Go to workspace chat and open the expense
  5. Note rate not valid error is not shown
  6. Tap more - duplicate expense
  7. Open the duplicate expense
  8. Note unexpected error is shown

Expected Result:

Rate not valid error must be shown after deleting per diem rate.

Actual Result:

Rate not valid error is not shown after deleting per diem rate in step 5.

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

Issue OwnerCurrent Issue Owner: @situchan
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022028953961846691915
  • Upwork Job ID: 2028953961846691915
  • Last Price Increase: 2026-03-03

Activity

  1. melvin-bot commented on Feb 16, 2026

    @melvin-bot

    📣 @Ducica! 📣
    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:

    1. Make sure you've read and understood the contributing guidelines.
    2. 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.
    3. 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.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  2. imadirtydog commented on Feb 16, 2026

    @imadirtydog

    Proposal

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

    After creating a per diem expense and deleting the rate/subrate used, the "Rate not valid for this workspace" error does not appear when opening the expense. Also, when duplicating this expense, you get unexpected error.

    What is the root cause of that problem?

    The isCustomUnitOutOfPolicy check has a fallback for distance requests but not for per diem. For distance, it checks (isDistanceRequest && !rate) directly. For per diem, it only relies on transactionViolations which are not recalculated when rates are deleted.

    const isCustomUnitOutOfPolicy = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) || (isDistanceRequest && !rate);

    For duplication, the issue happens, because you are creating expense with subrate that no longer exists in the policy.

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

    Add a fallback check for per diem requests that validates the rate and subrates still exist in the policy.

    const isCustomUnitOutOfPolicy = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) || (isDistanceRequest && !rate);

    const customUnitRateID = transaction?.comment?.customUnit?.customUnitRateID;
    const perDiemRate = customUnitRateID ? getPerDiemRateCustomUnitRate(policy, customUnitRateID) : undefined;
    const transactionSubRateIDs = transaction?.comment?.customUnit?.subRates?.map((subRate) => subRate.id) ?? [];
    const policySubRateIDs = perDiemRate?.subRates?.map((subRate) => subRate.id) ?? [];
    const hasInvalidPerDiemRate = isPerDiemRequest && !!customUnitRateID && !perDiemRate;
    const hasInvalidPerDiemSubRate = isPerDiemRequest && transactionSubRateIDs.length > 0 && transactionSubRateIDs.some((id) => !policySubRateIDs.includes(id));
    const isCustomUnitOutOfPolicy =
        transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.CUSTOM_UNIT_OUT_OF_POLICY) ||
        (isDistanceRequest && !rate) ||
        hasInvalidPerDiemRate ||
        hasInvalidPerDiemSubRate;

    For the duplication, the only reasonable place to fix it would be on the BE, though it could be some solution to not allow duplication on the FE side in case of isCustomUnitOutOfPolicy error.

    Note: This is a frontend fix. Backend should also recalculate violations when rates are deleted and return proper errors when duplicating expenses with invalid rates.

  3. melvin-bot commented on Feb 20, 2026

    @melvin-bot

    Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  4. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 3, 2026
  5. melvin-bot commented on Mar 3, 2026

    @melvin-bot

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

  6. 37 remaining items

  7. melvin-bot commented on Apr 13, 2026

    @melvin-bot

    @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

  8. JmillsExpensify commented on Apr 15, 2026

    @JmillsExpensify
    Contributor

    Still not overdue

  9. JmillsExpensify commented on Apr 16, 2026

    @JmillsExpensify
    Contributor

    @situchan what's the plan on this issue? Are you going to mark the draft PR ready for review?

  10. melvin-bot commented on Apr 20, 2026

    @melvin-bot

    @situchan Huh... This is 4 days overdue. Who can take care of this?

  11. JmillsExpensify commented on Apr 22, 2026

    @JmillsExpensify
    Contributor

    Closing. Re-open if this becomes a priority.

  12. situchan commented on Apr 22, 2026

    @situchan
    Contributor

    Retested. The issue is still reproducible.

    @JmillsExpensify where should we show rate not valid error when selected per diem rate is deleted?

    Image
  13. JmillsExpensify commented on Apr 23, 2026

    @JmillsExpensify
    Contributor

    Ok well the issue is we're not prioritizing it. So let's open it back up when we're ready.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions