-
Notifications
You must be signed in to change notification settings - Fork 49k
feat(Extract from File Node): Add Skip Records With Errors option
#21347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(Extract from File Node): Add Skip Records With Errors option
#21347
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 5 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="packages/nodes-base/nodes/SpreadsheetFile/v2/fromFile.operation.ts">
<violation number="1" location="packages/nodes-base/nodes/SpreadsheetFile/v2/fromFile.operation.ts:123">
`columns` needs to stay truthy by default; otherwise csv-parse stops mapping rows to object keys when the user leaves Header Row at its default. Please keep the prior `!== false` guard so the first row is still treated as headers unless the option is explicitly disabled.</violation>
<violation number="2" location="packages/nodes-base/nodes/SpreadsheetFile/v2/fromFile.operation.ts:170">
A user setting Max Skipped Records to 0 expects any skipped row to trigger an error, but the `> 0` guard skips that case. Treat all non-negative limits as active so 0 works as the strictest setting.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
packages/nodes-base/nodes/SpreadsheetFile/v2/fromFile.operation.ts
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| const maxSkippedRecords = options.skipRecordsWithErrors?.value?.maxSkippedRecords ?? -1; | ||
| if (skipRecordsWithErrors && maxSkippedRecords > 0 && skippedRecords > maxSkippedRecords) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A user setting Max Skipped Records to 0 expects any skipped row to trigger an error, but the > 0 guard skips that case. Treat all non-negative limits as active so 0 works as the strictest setting.
Prompt for AI agents
Address the following comment on packages/nodes-base/nodes/SpreadsheetFile/v2/fromFile.operation.ts at line 170:
<comment>A user setting Max Skipped Records to 0 expects any skipped row to trigger an error, but the `> 0` guard skips that case. Treat all non-negative limits as active so 0 works as the strictest setting.</comment>
<file context>
@@ -118,7 +151,26 @@ export async function execute(
+ }
+
+ const maxSkippedRecords = options.skipRecordsWithErrors?.value?.maxSkippedRecords ?? -1;
+ if (skipRecordsWithErrors && maxSkippedRecords > 0 && skippedRecords > maxSkippedRecords) {
+ throw new NodeOperationError(this.getNode(), 'Max number of skipped records exceeded', {
+ itemIndex: i,
</file context>
| if (skipRecordsWithErrors && maxSkippedRecords > 0 && skippedRecords > maxSkippedRecords) { | |
| if (skipRecordsWithErrors && maxSkippedRecords >= 0 && skippedRecords > maxSkippedRecords) { |
…n.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
|
✅ All jobs passed Summary: 2 successful workflows
Last updated: 2025-10-29 16:07:07 UTC |
Summary
This PR adds a new parameter that allows skipping records with errors when parsing csv files
It also fixes a bug, which made the node ignore errors when parsing binary data from buffer. It is a breaking behavior, so it's enabled only for new versions
Related Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/NODE-3690/extract-from-file-strict-csv-parsing-causing-full-file-failure
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)