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
[Due for payment 2026-07-17] [$250] CSV card feed import succeeds but no cards are created (no validation for missing required fields) #93704
Version Number: v9.4.8-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@Leeckhart Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Navigate to Workspace > Company Cards.
Create a new CSV Import card feed.
Upload a spreadsheet containing card transaction data with columns such as: Card Last 4, Spender, Merchant, Transaction Currency, Total Amount, (Missing: Date column)
Complete the import process.
Open the newly created card feed.
Expected Result:
The import process should validate required fields (including Date, if mandatory).
If a required column is missing, the system should:
Display a clear validation error, and/or
Prevent feed creation until the file is corrected.
If the file is valid, cards should appear in the feed after import.
Actual Result:
The CSV feed is created successfully.
No cards are added to the feed.
The feed displays: “No cards in this feed”
No validation error or warning is shown indicating that required data (e.g., Date column) is missing.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
The CSV company-card import only validates that a column is assigned to each required role — it never checks that the assigned column actually contains valid data. So when the spreadsheet has no Date column, the user can still satisfy the "Date is required" rule by mapping any other column (e.g. Spender) to Date, and validation passes.
validate() only flags a required role if it is unmapped — it does not inspect cell values:
The "Import successful" modal reports an optimistic, frontend-computed count, not the number of cards the backend actually created. In importCSVCompanyCards, transactionsCount = transactions.length (rows the client built from the CSV) is passed straight into the success modal. As long as the API returns 200, success is shown regardless of how many cards were imported.
The backend CSV scraper (CCUploadScraper.php, Server-Scraper repo) silently drops rows whose dates don't parse — a known "corrupted date → 0 files processed" path — so the feed is created with no cards and no error surfaced.
The net effect: feed created → "No cards in this feed" → no validation error, exactly as reported.
importTransactions() re-runs validate() and blocks the API call only when a role is unmapped — never based on cell contents.
Repro spreadsheet columns were Card Last 4, Spender, Merchant, Transaction Currency, Total Amount (no date). To clear the required-Date check, a non-date column had to be mapped to Date; the backend then couldn't parse those values into dates.
Note (cross-repo): the silent "0 transactions imported, no error" behavior lives in CCUploadScraper.php in the Server-Scraper repo, which is outside Expensify/App. A complete fix should also have the backend report invalid-date / zero-imported errors, but that change requires an internal engineer with access to that repo and can't be made here.
What changes do you think we should make in order to solve the problem?
Add value-level validation to the column-mapping step so the import is blocked (with a clear error) when a required column's data is invalid — specifically, when the column mapped to Date does not contain parseable dates.
In CompanyCardsImportedPage.tsx's validate(), after confirming Date is mapped, sample the values of the column mapped to POSTED_DATE and verify they parse as dates; if they don't, set a new error (e.g. csvErrors.invalidDateColumn) and surface it above the Import button the same way the existing errors.required message is shown.
Use a lenient date check so legitimate formats aren't rejected — the goal is to catch "this clearly isn't a date column," not to enforce one exact format.
This directly delivers the issue's expectation: a clear validation error that prevents feed creation until the file is corrected.
What alternative solutions did you explore? (Optional)
Have the success modal display the backend-reported imported count instead of the optimistic transactions.length, so "0 cards imported" shows a warning rather than a success message. (Requires the backend to return the real count.)
Backend fix in CCUploadScraper.php (Server-Scraper) to reject the upload or return an error when all rows have unparseable/missing dates. Best done in tandem with the frontend change, but it's outside this repo.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/93704) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
When a CSV company-card feed is imported with a file that is missing required transaction data (e.g. no usable Date column), the import reports success and the feed is created, but zero cards/transactions are added. The user lands on an empty "No cards in this feed" state with no validation error explaining what went wrong, even though the data was effectively rejected.
What is the root cause of that problem?
The CSV import has two validation gates, and both let a "no usable data" file through. The import is driven from CompanyCardsImportedPage. Its validate() only checks that each required column role (cardNumber, postedDate, merchant, amount, currency) has been assigned to some column — it never inspects whether those mapped columns actually contain parseable values:
This passes as long as columns are mapped. But auto-detection in ImportColumn.findColumnName will also remap a Date header onto POSTED_DATE (and similar fuzzy matches), so a column can be mapped to postedDate while holding values that aren't real dates. Once validate() passes, importTransactions calls importCSVCompanyCards, which builds the optimistic transactions in buildOptimisticCompanyCardCSVTransactions. That function silently drops every row whose required cells are empty or unparseable via a continue, so a missing/garbage Date column zeroes out the entire import:
The result is transactions.length === 0, yet the feed is still created (shouldCreateFeed write at CompanyCards.ts L1178-1203) and the success modal is shown unconditionally with titleKey: 'spreadsheet.importSuccessfulTitle'. Worse, importCompanyCardTransactionsSuccessfulDescription falls into its else branch for a count of 0 and tells the user "1 transaction has been added." The contrast with the sibling importer is the key: ImportedCategoriesPage.validate() already inspects the mapped column's data and blocks on empty values (containsEmptyName → spreadsheet.emptyMappedField), but the company-cards page has no equivalent data-level check.
What changes do you think we should make in order to solve the problem?
Add a data-level validation step to CompanyCardsImportedPage.validate(), mirroring the existing containsEmptyName pattern in ImportedCategoriesPage. After the role-presence and duplicate checks pass, locate each mapped required column, read its values from spreadsheet?.data, skip the header row when containsHeader is true, and if any required column has an empty value (or, for the date/amount columns, a value that fails the same parse the action uses), surface an emptyMappedField error keyed to that column so the Import button's OfflineWithFeedback displays it and the early return in importTransactions (L112-114) blocks feed creation. Conceptually:
This is safe because it runs only after all required roles are mapped, reuses the established emptyMappedField translation and the same containsHeader row-offset logic already shipped for categories, and changes nothing in the write path or for valid files. As a defensive backstop for cases that still parse to zero rows (e.g. every date is malformed), importCSVCompanyCards should short-circuit when transactions.length === 0 and return getImportFailedFinalModal() instead of creating the feed and showing the success modal, so a "valid columns / no usable rows" file can never produce a phantom empty feed.
What alternative solutions did you explore? (Optional)
Disabling the Import button whenever validationErrors is non-empty (today it's only gated on isOffline). That improves discoverability but doesn't fix the underlying gap — the button-disable still relies on role-presence validation, so a file with mapped-but-empty required columns would remain enabled and still create an empty feed; the data-level check is the actual fix.
CSV import validates column mapping but never validates that the mapped cells actually hold data, and rows missing required values are dropped silently.
The only upstream check (validate in CompanyCardsImportedPage) just confirms each required role is assigned to some column — not that those columns contain values:
Then, per row, buildOptimisticCompanyCardCSVTransactions silently continues whenever a required field (cardName/created/currency/amount) is empty — e.g. a missing/empty Date column makes created empty for every row:
So transactions comes back empty, but importCSVCompanyCards never guards on the count — it unconditionally calls API.write, which still creates the feed (shouldCreateFeed) and resolves the success modal:
transactions>1 ? `${transactions} transactions have been added.` : '1 transaction has been added.',
Chain: header-only validation passes → every row dropped silently → 0 transactions → no zero-count guard → feed created + "success" shown → "No cards in this feed", no error.
What changes do you think we should make in order to solve the problem?
Guard the convergence point. In importCSVCompanyCards, when transactions.length === 0 (after parsing), do not call API.write/create the feed — return an error modal telling the user no valid rows were found, so the failure is surfaced instead of a false success:
For example, when transactionsCount === 0, return getImportFailedFinalModal() (with copy clarifying that required fields like Date were empty) and skip the write.
Also fix the misleading success copy so 0 doesn't render as "1 transaction has been added.":
transactions>1 ? `${transactions} transactions have been added.` : '1 transaction has been added.',
What alternative solutions did you explore? (Optional)
Surface the problem earlier in CompanyCardsImportedPage.validate by counting how many data rows have a value for each required column and blocking import (with a clear error) when a required column has no usable data — preventing the empty feed from being created at all.
Please re-state the problem that we are trying to solve in this issue.
A CSV company-card import shows "Import successful" and creates the feed, but no cards appear and no error explains that a required field (e.g. Date) yielded no usable rows.
What is the root cause of that problem?
Validation only covers column mapping — nothing checks the row data or the resulting card count, so an import that yields zero cards still reports success and creates an empty feed.
validate() only flags unmapped required roles / duplicate mappings; it never inspects the actual cell values:
buildOptimisticCompanyCardCSVTransactions silently continues past every row whose required value (cardName / created / currency / amount) is missing or unparseable, so a file with no usable Date (or any missing required value) yields transactions = []:
importCSVCompanyCards computes transactionsCount but uses it only as a display param — the modal is hardcoded to importSuccessfulTitle and the feed is still created via shouldCreateFeed, regardless of count:
Chain explains every symptom: feed created ✓, zero cards ✓, no validation error ✓.
What changes do you think we should make in order to solve the problem?
Gate the result in the single import action importCSVCompanyCards: when transactionsCount === 0, return the existing getImportFailedFinalModal() and skip pushing the create-feed optimisticData, so the user sees a clear failure instead of an empty feed. The copy already fits — "Please ensure all fields are filled out correctly and try again":
Regression-safe: any file with ≥1 valid row takes the unchanged success path; both basic and advanced-field layouts flow through this one action.
What alternative solutions did you explore? (Optional)
Row-value checks in validate() + block in importTransactions: works but duplicates producer logic and a new copy key, and still creates the feed — gating the central action covers it once.
Strengthen column-mapping validation only — incomplete: can't catch a mapped-but-empty/invalid Date column, which is the reported case (the feed was created, so mapping validation already passed).
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[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: NA
[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.
Activity
MelvinBot commentedon Jun 16, 2026
Proposal
What is the root cause of that problem?
The CSV company-card import only validates that a column is assigned to each required role — it never checks that the assigned column actually contains valid data. So when the spreadsheet has no Date column, the user can still satisfy the "Date is required" rule by mapping any other column (e.g.
Spender) to Date, and validation passes.validate()only flags a required role if it is unmapped — it does not inspect cell values:Two things then combine to hide the failure:
importCSVCompanyCards,transactionsCount = transactions.length(rows the client built from the CSV) is passed straight into the success modal. As long as the API returns 200, success is shown regardless of how many cards were imported.CCUploadScraper.php, Server-Scraper repo) silently drops rows whose dates don't parse — a known "corrupted date → 0 files processed" path — so the feed is created with no cards and no error surfaced.The net effect: feed created → "No cards in this feed" → no validation error, exactly as reported.
Evidence & data flow
POSTED_DATE, labeled "Date") are declared atCompanyCardsImportedPage.tsx:53-77.importTransactions()re-runsvalidate()and blocks the API call only when a role is unmapped — never based on cell contents.Card Last 4, Spender, Merchant, Transaction Currency, Total Amount(no date). To clear the required-Date check, a non-date column had to be mapped to Date; the backend then couldn't parse those values into dates.CompanyCards.ts:1156-1163.Note (cross-repo): the silent "0 transactions imported, no error" behavior lives in
CCUploadScraper.phpin the Server-Scraper repo, which is outsideExpensify/App. A complete fix should also have the backend report invalid-date / zero-imported errors, but that change requires an internal engineer with access to that repo and can't be made here.What changes do you think we should make in order to solve the problem?
Add value-level validation to the column-mapping step so the import is blocked (with a clear error) when a required column's data is invalid — specifically, when the column mapped to Date does not contain parseable dates.
CompanyCardsImportedPage.tsx'svalidate(), after confirming Date is mapped, sample the values of the column mapped toPOSTED_DATEand verify they parse as dates; if they don't, set a new error (e.g.csvErrors.invalidDateColumn) and surface it above the Import button the same way the existingerrors.requiredmessage is shown.This directly delivers the issue's expectation: a clear validation error that prevents feed creation until the file is corrected.
What alternative solutions did you explore? (Optional)
transactions.length, so "0 cards imported" shows a warning rather than a success message. (Requires the backend to return the real count.)CCUploadScraper.php(Server-Scraper) to reject the upload or return an error when all rows have unparseable/missing dates. Best done in tandem with the frontend change, but it's outside this repo.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/93704)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
MobileMage commentedon Jun 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a CSV company-card feed is imported with a file that is missing required transaction data (e.g. no usable Date column), the import reports success and the feed is created, but zero cards/transactions are added. The user lands on an empty "No cards in this feed" state with no validation error explaining what went wrong, even though the data was effectively rejected.
What is the root cause of that problem?
The CSV import has two validation gates, and both let a "no usable data" file through. The import is driven from
CompanyCardsImportedPage. Itsvalidate()only checks that each required column role (cardNumber,postedDate,merchant,amount,currency) has been assigned to some column — it never inspects whether those mapped columns actually contain parseable values:App/src/pages/workspace/companyCards/addNew/CompanyCardsImportedPage.tsx
Lines 85 to 90 in bf205a7
So the check is purely role-presence, not data-presence:
This passes as long as columns are mapped. But auto-detection in
ImportColumn.findColumnNamewill also remap aDateheader ontoPOSTED_DATE(and similar fuzzy matches), so a column can be mapped topostedDatewhile holding values that aren't real dates. Oncevalidate()passes,importTransactionscallsimportCSVCompanyCards, which builds the optimistic transactions inbuildOptimisticCompanyCardCSVTransactions. That function silently drops every row whose required cells are empty or unparseable via acontinue, so a missing/garbage Date column zeroes out the entire import:App/src/libs/actions/CompanyCards.ts
Lines 126 to 130 in bf205a7
The result is
transactions.length === 0, yet the feed is still created (shouldCreateFeedwrite atCompanyCards.tsL1178-1203) and the success modal is shown unconditionally withtitleKey: 'spreadsheet.importSuccessfulTitle'. Worse,importCompanyCardTransactionsSuccessfulDescriptionfalls into itselsebranch for a count of0and tells the user "1 transaction has been added." The contrast with the sibling importer is the key:ImportedCategoriesPage.validate()already inspects the mapped column's data and blocks on empty values (containsEmptyName→spreadsheet.emptyMappedField), but the company-cards page has no equivalent data-level check.What changes do you think we should make in order to solve the problem?
Add a data-level validation step to
CompanyCardsImportedPage.validate(), mirroring the existingcontainsEmptyNamepattern inImportedCategoriesPage. After the role-presence and duplicate checks pass, locate each mapped required column, read its values fromspreadsheet?.data, skip the header row whencontainsHeaderis true, and if any required column has an empty value (or, for the date/amount columns, a value that fails the same parse the action uses), surface anemptyMappedFielderror keyed to that column so the Import button'sOfflineWithFeedbackdisplays it and the earlyreturninimportTransactions(L112-114) blocks feed creation. Conceptually:This is safe because it runs only after all required roles are mapped, reuses the established
emptyMappedFieldtranslation and the samecontainsHeaderrow-offset logic already shipped for categories, and changes nothing in the write path or for valid files. As a defensive backstop for cases that still parse to zero rows (e.g. every date is malformed),importCSVCompanyCardsshould short-circuit whentransactions.length === 0and returngetImportFailedFinalModal()instead of creating the feed and showing the success modal, so a "valid columns / no usable rows" file can never produce a phantom empty feed.What alternative solutions did you explore? (Optional)
Disabling the Import button whenever
validationErrorsis non-empty (today it's only gated onisOffline). That improves discoverability but doesn't fix the underlying gap — the button-disable still relies on role-presence validation, so a file with mapped-but-empty required columns would remain enabled and still create an empty feed; the data-level check is the actual fix.lorretheboy commentedon Jun 16, 2026
Proposal
What is the root cause of that problem?
CSV import validates column mapping but never validates that the mapped cells actually hold data, and rows missing required values are dropped silently.
The only upstream check (
validateinCompanyCardsImportedPage) just confirms each required role is assigned to some column — not that those columns contain values:App/src/pages/workspace/companyCards/addNew/CompanyCardsImportedPage.tsx
Lines 85 to 90 in bf205a7
Then, per row,
buildOptimisticCompanyCardCSVTransactionssilentlycontinues whenever a required field (cardName/created/currency/amount) is empty — e.g. a missing/empty Date column makescreatedempty for every row:App/src/libs/actions/CompanyCards.ts
Lines 128 to 130 in bf205a7
So
transactionscomes back empty, butimportCSVCompanyCardsnever guards on the count — it unconditionally callsAPI.write, which still creates the feed (shouldCreateFeed) and resolves the success modal:App/src/libs/actions/CompanyCards.ts
Line 1146 in bf205a7
App/src/libs/actions/CompanyCards.ts
Line 1217 in bf205a7
The success copy even hides the zero — for
0it falls into theelsebranch and reads "1 transaction has been added.":App/src/languages/en.ts
Lines 1168 to 1169 in bf205a7
Chain: header-only validation passes → every row dropped silently → 0 transactions → no zero-count guard → feed created + "success" shown → "No cards in this feed", no error.
What changes do you think we should make in order to solve the problem?
Guard the convergence point. In
importCSVCompanyCards, whentransactions.length === 0(after parsing), do not callAPI.write/create the feed — return an error modal telling the user no valid rows were found, so the failure is surfaced instead of a false success:App/src/libs/actions/CompanyCards.ts
Line 1146 in bf205a7
For example, when
transactionsCount === 0, returngetImportFailedFinalModal()(with copy clarifying that required fields like Date were empty) and skip the write.Also fix the misleading success copy so
0doesn't render as "1 transaction has been added.":App/src/languages/en.ts
Lines 1168 to 1169 in bf205a7
What alternative solutions did you explore? (Optional)
Surface the problem earlier in
CompanyCardsImportedPage.validateby counting how many data rows have a value for each required column and blocking import (with a clear error) when a required column has no usable data — preventing the empty feed from being created at all.ahmdshrif commentedon Jun 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
A CSV company-card import shows "Import successful" and creates the feed, but no cards appear and no error explains that a required field (e.g. Date) yielded no usable rows.
What is the root cause of that problem?
Validation only covers column mapping — nothing checks the row data or the resulting card count, so an import that yields zero cards still reports success and creates an empty feed.
validate()only flags unmapped required roles / duplicate mappings; it never inspects the actual cell values:App/src/pages/workspace/companyCards/addNew/CompanyCardsImportedPage.tsx
Lines 81 to 100 in bf205a7
buildOptimisticCompanyCardCSVTransactionssilentlycontinues past every row whose required value (cardName / created / currency / amount) is missing or unparseable, so a file with no usable Date (or any missing required value) yieldstransactions = []:App/src/libs/actions/CompanyCards.ts
Lines 117 to 133 in bf205a7
importCSVCompanyCardscomputestransactionsCountbut uses it only as a display param — the modal is hardcoded toimportSuccessfulTitleand the feed is still created viashouldCreateFeed, regardless of count:App/src/libs/actions/CompanyCards.ts
Lines 1146 to 1163 in bf205a7
Chain explains every symptom: feed created ✓, zero cards ✓, no validation error ✓.
What changes do you think we should make in order to solve the problem?
Gate the result in the single import action
importCSVCompanyCards: whentransactionsCount === 0, return the existinggetImportFailedFinalModal()and skip pushing the create-feedoptimisticData, so the user sees a clear failure instead of an empty feed. The copy already fits — "Please ensure all fields are filled out correctly and try again":App/src/languages/en.ts
Lines 1191 to 1192 in bf205a7
Regression-safe: any file with ≥1 valid row takes the unchanged success path; both basic and advanced-field layouts flow through this one action.
What alternative solutions did you explore? (Optional)
validate()+ block inimportTransactions: works but duplicates producer logic and a new copy key, and still creates the feed — gating the central action covers it once.68 remaining items
melvin-bot commentedon Jul 15, 2026
@shubham1206agra Huh... This is 4 days overdue. Who can take care of this?
shubham1206agra commentedon Jul 16, 2026
Payment tomorrow
melvin-bot commentedon Jul 16, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jul 16, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jul 20, 2026
Payment Summary
Contributor+: @shubham1206agra due $250 via NewDot
@shubham1206agra plz complete the BZ checklist and tag me in a post once you have. Thx
shubham1206agra commentedon Jul 21, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: https://github.com/Expensify/App/pull/80636/changes#r3623617169
Link to the comment on the Issue: NA
[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: NA
[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/662927
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-420b-a001-4f78-22d8785be794shubham1206agra commentedon Jul 21, 2026
@mallenexpensify Please close this issue now
JmillsExpensify commentedon Aug 10, 2026
$250 approved for @shubham1206agra