Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Beyond COPY INTO: How to Capture and Export Rejected Records in Snowflake

Snowflake’s COPY summary is not a complete error ledger. Validate the affected files, capture the result ID, and unload rejected records for analysis and correction.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To preserve malformed rows from a Snowflake bulk load, inspect the target table’s COPY history, validate the affected files with VALIDATION_MODE = RETURN_ALL_ERRORS, then unload the validation output’s REJECTED_RECORD values to a stage file. Validation checks the files without loading rows; the exported file gives you records to investigate and correct.

What COPY load errors tell you—and what they leave out

Start with the load’s file-level history to find the affected files, their status, and the reported first error. Snowflake’s bulk-load troubleshooting guide explains that status distinguishes files that loaded, partially loaded, or failed. The first-error field is only a clue: if a file has multiple issues, it reports only the first.

As an Amazon Associate I earn from qualifying purchases.

With ON_ERROR = CONTINUE, Snowflake keeps processing despite detected errors. The COPY result reports at most one error per data file. Comparing rows parsed with rows loaded can indicate rows with detected errors, but it does not count every error: a single row may contain more than one. For fuller row-level diagnostics, validate the files or use the VALIDATE table function. See the COPY INTO reference and the troubleshooting guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Capture and offload rejected records

Use the same file set that produced the load issue. Adapt the table, stage, file path, and output path to your account and load attempt.

  1. Validate without loading. Run a COPY validation with VALIDATION_MODE = RETURN_ALL_ERRORS. RETURN_ERRORS returns errors across the specified files; RETURN_ALL_ERRORS also includes errors from files partially loaded earlier with ON_ERROR = CONTINUE.
  2. Save the validation query ID immediately. The result is the input to the unload step. Snowflake cautions that when using LAST_QUERY_ID(), the statements need to run in succession so the ID refers to the validation result.
  3. Unload the rejected-record field. Select REJECTED_RECORD from the validation result using RESULT_SCAN, then write it to a stage location with COPY INTO <location>.
  4. Reconcile and remediate. Keep the output tied in your own pipeline records to the original load attempt and file set, then correct the source or apply an explicit remediation process. Snowflake documents the validation-and-unload sequence; the reconciliation practice is an operational safeguard, not a platform guarantee.
COPY INTO mytable
  FROM @mystage/myfile.csv.gz
  VALIDATION_MODE = RETURN_ALL_ERRORS;

SET qid = LAST_QUERY_ID();

COPY INTO @mystage/errors/load_errors.txt
  FROM (SELECT rejected_record FROM TABLE(RESULT_SCAN($qid)));

This pattern follows Snowflake’s documented bulk-load troubleshooting example. Validation does not insert rows into the target table. The unload writes the problematic records to a text file so they can be analyzed and fixed in the original data files.

Choose an error policy for the load itself

Error policy controls what happens during loading; it does not replace a rejected-record preservation workflow. The behaviors below are described in Snowflake’s COPY INTO reference.

Policy Load behavior Diagnostic and operational trade-off
ABORT_STATEMENT Default behavior; stops when an error is encountered. Useful when you want the statement to stop rather than continue loading valid rows after an error. Plan how to inspect and recover the batch.
CONTINUE Continues loading good rows despite detected errors. The COPY summary reports no more than one error per file, so follow with validation or VALIDATE when fuller diagnostics are needed.
SKIP_FILE Discards a file when an error is found. Snowflake buffers the entire file; this may be slower than CONTINUE or ABORT_STATEMENT, especially if a large file contains only a few bad rows.

Know when validation is not a fit

  • Transformed COPY loads: VALIDATION_MODE does not support COPY statements that transform data, and the VALIDATE function also does not support those transformation statements. Use a diagnostic path designed for the transformed pipeline instead of assuming this workflow captures every failure. Snowflake’s transform-data-during-load guide also describes limitations in error handling involving scalar SQL UDFs.
  • Iceberg tables: VALIDATION_MODE is not supported for Iceberg tables.
  • Parquet conversions: COPY does not validate data type conversions for Parquet files, so validation is not a universal semantic data-quality check.
  • Special load patterns: Snowflake documents possible inconsistent or unexpected ON_ERROR behavior in some cases, including DISTINCT in a SELECT and clustered tables. It also notes an ON_ERROR caveat for CSV loads when a stream is on the target table. Check the COPY reference if these apply to your load.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep load history in context

File history is useful for identifying the load and its first reported error, but it is not a substitute for exporting row-level validation results. Snowflake’s S3 loading guide says historical data for COPY commands is retained for the previous 14 days. That figure is stated in the context of that guide; confirm the applicable history view and account context rather than treating it as a universal retention guarantee.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.