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 - 'Tag no longer valid' error not displayed #85214
Version Number: v9.3.37-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://test-management.browserstack.com/projects/2219752/folder/13176791/test-cases/41237176 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Windows 11, Chrome App Component: Workspace Settings
Action Performed:
Preconditions:
The user has a workspace with 1 admin as a member
The workspace has tags enabled with at least 1 tag
Please re-state the problem that we are trying to solve in this issue.
When a user creates a split expense offline with a tag, and another admin deletes that tag from the workspace while the user is offline, no "Tag no longer valid" error is shown after the user goes back online. The tagOutOfPolicy violation never appears on the split expense's child transactions.
What is the root cause of that problem?
The split bill creation flow skips client-side violation computation entirely. When createSplitsAndOnyxData (in src/libs/actions/IOU/index.ts:7461) builds Onyx data for each split participant's child transaction, it calls buildOnyxDataForMoneyRequestwithout passing policyParams:
buildOnyxDataForMoneyRequest({
isOneOnOneSplit: true,
// policyParams is NOT passed — defaults to {}
optimisticParams: { ... },
...
});
Inside buildOnyxDataForMoneyRequest, policyParams defaults to {}, so policy is undefined. The guard at line 2484-2486 then triggers an early return:
if(!policy||!isPaidGroupPolicy(policy)|| ...){returnonyxData;// Skips ALL violation computation}
This means ViolationsUtils.getViolationsOnyxData() is never called for split child transactions — no tagOutOfPolicy, categoryOutOfPolicy, or any other violations are computed.
In contrast, regular (non-split) expenses go through getMoneyRequestInformation (line 3594-3603) which does pass policyParams: { policy, policyCategories, policyTagList }, so violations are computed optimistically at creation time.
Additionally, there is no reactive client-side mechanism that recomputes violations when policy tags are updated via Pusher/Onyx sync. The pushTransactionViolationsOnyxData function in ReportUtils.ts only runs on the admin's device that performs the tag deletion — other users rely entirely on server-pushed violation updates.
What changes do you think we should make in order to solve the problem?
Pass policyParams (including policy, policyCategories, and policyTagList) through the split bill creation flow so that buildOnyxDataForMoneyRequest can compute violations for split child transactions:
Update CreateSplitsAndOnyxDataParams (in src/libs/actions/IOU/index.ts:656) to accept an optional policyParams field of type BasePolicyParams.
Update createSplitsAndOnyxData (line 7027) to accept and destructure the new policyParams field, and pass it to buildOnyxDataForMoneyRequest at line 7461.
Update callers — splitBill, splitBillAndOpenReport, and their callers in IOURequestStepConfirmation.tsx — to pass policy, policyCategories, and policyTagList through (these are already available in the component via usePolicyForTransaction and usePolicyCategories hooks).
Similarly update completeSplitBill in Split.ts which has the same gap.
This aligns the split bill flow with how getMoneyRequestInformation already handles violation computation for regular expenses, ensuring tagOutOfPolicy (and other violations) are computed optimistically for split child transactions.
What alternative solutions did you explore? (Optional)
An alternative would be adding a reactive client-side mechanism (e.g., an Onyx subscriber on POLICY_TAGS) that recomputes violations when policy tag data changes. However, this would be more complex and less targeted — the simpler fix is to compute violations at split creation time, matching the existing pattern for regular expenses.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
changed the title [-]Expense - 'Tag no longer valid' error not displayed[/-][+][$250] Expense - 'Tag no longer valid' error not displayed[/+]on Mar 13, 2026
Please re-state the problem that we are trying to solve in this issue.
When a workspace tag is deleted by an admin while a transaction owner is offline, and the owner had tagged a split expense with that tag while offline, coming back online does not display the "Tag no longer valid" (tagOutOfPolicy) violation on the affected split transaction.
What is the root cause of that problem?
The deletePolicyTags action in src/libs/actions/Policy/Tag.ts calls pushTransactionViolationsOnyxData to recompute violations optimistically (when the delete is pending). This correctly adds a tagOutOfPolicy violation for transactions that use the deleted tag — but only on the admin's device where the delete action runs. The call to pushTransactionViolationsOnyxData produces entries only in optimisticData and failureData, never in successData.
When the transaction owner is offline during the delete, their device never runs deletePolicyTags. When they reconnect, Onyx syncs the updated policy tags (deleted tags become null), but nothing recalculates violations for existing transactions. The split's queued request was built with an optimistic violation set computed when the tag was still valid (no tagOutOfPolicy). When that request succeeds, successData only clears pendingAction/pendingFields — there is no violation re-evaluation against the now-current policy tags.
pushTransactionViolationsOnyxData is called with the optimistic update (enabled: false) but there is no corresponding call to populate successData with violations that reflect the final state (null — tag fully removed). The owner's device, which receives the final state via Onyx sync, ends up with the deleted tag absent from policyTags but with no updated violations on their existing transactions.
What changes do you think we should make in order to solve the problem?
In deletePolicyTags in src/libs/actions/Policy/Tag.ts, add a second call to pushTransactionViolationsOnyxData that targets successData using the final tag update (the same null-valued entries that the current successData already writes for the policy tags). This way, when the success response is applied on any device — including one that was offline during the delete — the violations for all relevant transactions are recomputed reflecting the fully-removed tag.
The pushTransactionViolationsOnyxData function already handles null tag updates correctly: it filters out null-valued tags from the merged tag list, causing any transaction that still references the deleted tag to have isTagInPolicy = false, which generates a tagOutOfPolicy violation as long as other enabled tags exist.
pushTransactionViolationsOnyxData(onyxData, policyData, {}, {}, policyTagsOptimisticData);
+ // Also push violation updates into successData, using the final state where deleted tags are null.+ // This ensures that devices which were offline during the delete (and receive the success state+ // via Onyx sync) also get their transaction violations recomputed against the updated tag list.+ const successOnyxData: OnyxData<typeof ONYXKEYS.COLLECTION.POLICY_TAGS | typeof ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS> = {+ optimisticData: onyxData.successData,+ failureData: [],+ };+ const policyTagsSuccessData: Record<string, Record<string, Partial<OnyxValueWithOfflineFeedback<PolicyTag>> | null>> = {+ [policyTag.name]: {+ tags: tagsToDelete.reduce<Record<string, null>>((acc, tagName) => {+ acc[tagName] = null;+ return acc;+ }, {}),+ },+ };+ pushTransactionViolationsOnyxData(successOnyxData, policyData, {}, {}, policyTagsSuccessData);
const parameters = {
The trick here is constructing a temporary OnyxData-shaped object whose optimisticData is a reference to the real onyxData.successData array, so that pushTransactionViolationsOnyxData's internal onyxData.optimisticData?.push(...) calls append directly into the existing successData array. The failureData for this secondary call is intentionally empty — the failure path for the overall deletePolicyTags is already handled by the existing failureData which rolls back the tag list, which in turn rolls back violations via the first call's failureData.
What alternative solutions did you explore? (Optional)
An alternative would be to add an Onyx listener that watches for changes to POLICY_TAGS and re-evaluates violations for all policy transactions whenever tags are removed. This is more general but heavier — it would fire on every tag update regardless of whether any transaction is affected, and would require subscribing to both POLICY_TAGS and TRANSACTION collections simultaneously. The approach above is more surgical and consistent with how the rest of the codebase handles this pattern (e.g., setWorkspaceTagEnabled already uses pushTransactionViolationsOnyxData for its optimistic/failure paths).
Please re-state the problem that we are trying to solve in this issue.
When a user splits an existing expense (More > Split), selects a tag while offline, and the tag gets deleted by another admin before the user goes back online, no "Tag no longer valid" error appears. The tag violation is silently skipped for split child transactions.
What is the root cause of that problem?
The issue is a property name mismatch in updateSplitTransactions() at Split.ts:1165. The policyParams object is built using JavaScript shorthand notation:
But BasePolicyParams (defined at index.ts:497-503) expects the property to be called policyTagList, not policyTags. When getMoneyRequestInformation (index.ts:3274) destructures policyTagList from this object, it gets undefined. That undefined flows into buildOnyxDataForMoneyRequest where policyTagList ?? {} falls back to an empty object, and ViolationsUtils.getViolationsOnyxData() sees no tags to validate against — so tagOutOfPolicy is never added.
This only affects the "split existing expense" path. Every other caller of buildOnyxDataForMoneyRequest maps the property correctly (e.g., getMoneyRequestInformation at index.ts:3599, SendInvoice.ts:701).
The as MoneyRequestInformationParams type assertion at Split.ts:1203 hides this from TypeScript — without it, tsc would have flagged the mismatch at compile time.
What changes do you think we should make in order to solve the problem?
One-line fix at Split.ts:1165 — change policyTags, to policyTagList: policyTags,. This maps the local variable to the property name BasePolicyParams expects, so the full violation computation pipeline receives the actual policy tag data.
This also fixes missingTag violations for splits (same dependency on policyTagList). Category violations are unaffected since policyCategories was already named correctly.
What alternative solutions did you explore? (Optional)
Renaming policyTagList to policyTags globally in BasePolicyParams would avoid this kind of mismatch, but it touches 20+ files that already use policyTagList correctly — not worth the churn for a one-line call-site fix. Separately, removing the as MoneyRequestInformationParams assertion at line 1203 would let TypeScript catch issues like this in the future, but that's a follow-up improvement, not the fix itself.
Activity
MelvinBot commentedon Mar 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user creates a split expense offline with a tag, and another admin deletes that tag from the workspace while the user is offline, no "Tag no longer valid" error is shown after the user goes back online. The
tagOutOfPolicyviolation never appears on the split expense's child transactions.What is the root cause of that problem?
The split bill creation flow skips client-side violation computation entirely. When
createSplitsAndOnyxData(insrc/libs/actions/IOU/index.ts:7461) builds Onyx data for each split participant's child transaction, it callsbuildOnyxDataForMoneyRequestwithout passingpolicyParams:Inside
buildOnyxDataForMoneyRequest,policyParamsdefaults to{}, sopolicyisundefined. The guard at line 2484-2486 then triggers an early return:This means
ViolationsUtils.getViolationsOnyxData()is never called for split child transactions — notagOutOfPolicy,categoryOutOfPolicy, or any other violations are computed.In contrast, regular (non-split) expenses go through
getMoneyRequestInformation(line 3594-3603) which does passpolicyParams: { policy, policyCategories, policyTagList }, so violations are computed optimistically at creation time.Additionally, there is no reactive client-side mechanism that recomputes violations when policy tags are updated via Pusher/Onyx sync. The
pushTransactionViolationsOnyxDatafunction inReportUtils.tsonly runs on the admin's device that performs the tag deletion — other users rely entirely on server-pushed violation updates.What changes do you think we should make in order to solve the problem?
Pass
policyParams(includingpolicy,policyCategories, andpolicyTagList) through the split bill creation flow so thatbuildOnyxDataForMoneyRequestcan compute violations for split child transactions:Update
CreateSplitsAndOnyxDataParams(insrc/libs/actions/IOU/index.ts:656) to accept an optionalpolicyParamsfield of typeBasePolicyParams.Update
createSplitsAndOnyxData(line 7027) to accept and destructure the newpolicyParamsfield, and pass it tobuildOnyxDataForMoneyRequestat line 7461.Update callers —
splitBill,splitBillAndOpenReport, and their callers inIOURequestStepConfirmation.tsx— to passpolicy,policyCategories, andpolicyTagListthrough (these are already available in the component viausePolicyForTransactionandusePolicyCategorieshooks).Similarly update
completeSplitBillinSplit.tswhich has the same gap.This aligns the split bill flow with how
getMoneyRequestInformationalready handles violation computation for regular expenses, ensuringtagOutOfPolicy(and other violations) are computed optimistically for split child transactions.What alternative solutions did you explore? (Optional)
An alternative would be adding a reactive client-side mechanism (e.g., an Onyx subscriber on
POLICY_TAGS) that recomputes violations when policy tag data changes. However, this would be more complex and less targeted — the simpler fix is to compute violations at split creation time, matching the existing pattern for regular expenses.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Mar 13, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (
External)[-]Expense - 'Tag no longer valid' error not displayed[/-][+][$250] Expense - 'Tag no longer valid' error not displayed[/+]melvin-bot commentedon Mar 13, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022032402994386771619
MobileMage commentedon Mar 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace tag is deleted by an admin while a transaction owner is offline, and the owner had tagged a split expense with that tag while offline, coming back online does not display the "Tag no longer valid" (
tagOutOfPolicy) violation on the affected split transaction.What is the root cause of that problem?
The
deletePolicyTagsaction insrc/libs/actions/Policy/Tag.tscallspushTransactionViolationsOnyxDatato recompute violations optimistically (when the delete is pending). This correctly adds atagOutOfPolicyviolation for transactions that use the deleted tag — but only on the admin's device where the delete action runs. The call topushTransactionViolationsOnyxDataproduces entries only inoptimisticDataandfailureData, never insuccessData.When the transaction owner is offline during the delete, their device never runs
deletePolicyTags. When they reconnect, Onyx syncs the updated policy tags (deleted tags becomenull), but nothing recalculates violations for existing transactions. The split's queued request was built with an optimistic violation set computed when the tag was still valid (notagOutOfPolicy). When that request succeeds,successDataonly clearspendingAction/pendingFields— there is no violation re-evaluation against the now-current policy tags.The gap is specifically at line 485 in
Tag.ts:App/src/libs/actions/Policy/Tag.ts
Line 485 in 5ab0f25
pushTransactionViolationsOnyxDatais called with the optimistic update (enabled: false) but there is no corresponding call to populatesuccessDatawith violations that reflect the final state (null— tag fully removed). The owner's device, which receives the final state via Onyx sync, ends up with the deleted tag absent frompolicyTagsbut with no updated violations on their existing transactions.What changes do you think we should make in order to solve the problem?
In
deletePolicyTagsinsrc/libs/actions/Policy/Tag.ts, add a second call topushTransactionViolationsOnyxDatathat targetssuccessDatausing the final tag update (the samenull-valued entries that the currentsuccessDataalready writes for the policy tags). This way, when the success response is applied on any device — including one that was offline during the delete — the violations for all relevant transactions are recomputed reflecting the fully-removed tag.The
pushTransactionViolationsOnyxDatafunction already handlesnulltag updates correctly: it filters outnull-valued tags from the merged tag list, causing any transaction that still references the deleted tag to haveisTagInPolicy = false, which generates atagOutOfPolicyviolation as long as other enabled tags exist.App/src/libs/actions/Policy/Tag.ts
Lines 483 to 492 in 5ab0f25
pushTransactionViolationsOnyxData(onyxData, policyData, {}, {}, policyTagsOptimisticData); + // Also push violation updates into successData, using the final state where deleted tags are null. + // This ensures that devices which were offline during the delete (and receive the success state + // via Onyx sync) also get their transaction violations recomputed against the updated tag list. + const successOnyxData: OnyxData<typeof ONYXKEYS.COLLECTION.POLICY_TAGS | typeof ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS> = { + optimisticData: onyxData.successData, + failureData: [], + }; + const policyTagsSuccessData: Record<string, Record<string, Partial<OnyxValueWithOfflineFeedback<PolicyTag>> | null>> = { + [policyTag.name]: { + tags: tagsToDelete.reduce<Record<string, null>>((acc, tagName) => { + acc[tagName] = null; + return acc; + }, {}), + }, + }; + pushTransactionViolationsOnyxData(successOnyxData, policyData, {}, {}, policyTagsSuccessData); const parameters = {The trick here is constructing a temporary
OnyxData-shaped object whoseoptimisticDatais a reference to the realonyxData.successDataarray, so thatpushTransactionViolationsOnyxData's internalonyxData.optimisticData?.push(...)calls append directly into the existingsuccessDataarray. ThefailureDatafor this secondary call is intentionally empty — the failure path for the overalldeletePolicyTagsis already handled by the existingfailureDatawhich rolls back the tag list, which in turn rolls back violations via the first call'sfailureData.What alternative solutions did you explore? (Optional)
An alternative would be to add an Onyx listener that watches for changes to
POLICY_TAGSand re-evaluates violations for all policy transactions whenever tags are removed. This is more general but heavier — it would fire on every tag update regardless of whether any transaction is affected, and would require subscribing to bothPOLICY_TAGSandTRANSACTIONcollections simultaneously. The approach above is more surgical and consistent with how the rest of the codebase handles this pattern (e.g.,setWorkspaceTagEnabledalready usespushTransactionViolationsOnyxDatafor its optimistic/failure paths).shivang-goliyan commentedon Mar 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user splits an existing expense (More > Split), selects a tag while offline, and the tag gets deleted by another admin before the user goes back online, no "Tag no longer valid" error appears. The tag violation is silently skipped for split child transactions.
What is the root cause of that problem?
The issue is a property name mismatch in
updateSplitTransactions()atSplit.ts:1165. ThepolicyParamsobject is built using JavaScript shorthand notation:But
BasePolicyParams(defined atindex.ts:497-503) expects the property to be calledpolicyTagList, notpolicyTags. WhengetMoneyRequestInformation(index.ts:3274) destructurespolicyTagListfrom this object, it getsundefined. Thatundefinedflows intobuildOnyxDataForMoneyRequestwherepolicyTagList ?? {}falls back to an empty object, andViolationsUtils.getViolationsOnyxData()sees no tags to validate against — sotagOutOfPolicyis never added.This only affects the "split existing expense" path. Every other caller of
buildOnyxDataForMoneyRequestmaps the property correctly (e.g.,getMoneyRequestInformationatindex.ts:3599,SendInvoice.ts:701).The
as MoneyRequestInformationParamstype assertion atSplit.ts:1203hides this from TypeScript — without it,tscwould have flagged the mismatch at compile time.What changes do you think we should make in order to solve the problem?
One-line fix at
Split.ts:1165— changepolicyTags,topolicyTagList: policyTags,. This maps the local variable to the property nameBasePolicyParamsexpects, so the full violation computation pipeline receives the actual policy tag data.This also fixes
missingTagviolations for splits (same dependency onpolicyTagList). Category violations are unaffected sincepolicyCategorieswas already named correctly.What alternative solutions did you explore? (Optional)
Renaming
policyTagListtopolicyTagsglobally inBasePolicyParamswould avoid this kind of mismatch, but it touches 20+ files that already usepolicyTagListcorrectly — not worth the churn for a one-line call-site fix. Separately, removing theas MoneyRequestInformationParamsassertion at line 1203 would let TypeScript catch issues like this in the future, but that's a follow-up improvement, not the fix itself.FitseTLT commentedon Mar 13, 2026
BE bug
30 remaining items
allgandalf commentedon Apr 7, 2026
Raised a BE PR for this:
allgandalf commentedon Apr 8, 2026
PR in review
allgandalf commentedon Apr 9, 2026
^
allgandalf commentedon Apr 10, 2026
^
melvin-bot commentedon Apr 13, 2026
@allgandalf Whoops! This issue is 2 days overdue. Let's get this updated quick!
allgandalf commentedon Apr 15, 2026
Auth PR was deployed, Asked for retest :
IuliiaHerets commentedon Apr 15, 2026
v9.3.59-3
Windows 11 / Chrome
not repro
tags.mp4
allgandalf commentedon Apr 15, 2026
Closing this out, please comment if anything is remaining which i might have missed