Snowflake now keeps the rows your loads reject
Error tables for COPY INTO and Snowpipe, generally available since November 2026, keep every rejected row and the reason. How to use them, and what to govern.
Code for this article
cloudcentrix-labs/snowflake-data-pipelinesCOPY and Snowpipe ingestion, error tables that keep the rows a load rejects, semantic view materializations and dynamic table chains.
In CI. Lints the SQL with sqlfluff, skipping a few statements with newer syntax. That does not prove the scripts run.
Every data team has had the conversation. The finance report is short by a few hundred orders, the load "succeeded", and nobody can say which rows went missing or why. Until now, Snowflake gave you two blunt choices for bad data in a load: stop everything, or skip it and dig through VALIDATE output later.
On 19 November 2026 Snowflake made error tables generally available for COPY INTO and Snowpipe. A table can now keep every row a load rejects, with the reason and the original record, in a place you can query with plain SQL. Loads also enforce CHECK constraints, which means simple data rules can live on the table itself.
Switching it on
Error logging is a table property:
ALTER TABLE orders SET ERROR_LOGGING = TRUE;
Or, with a rule on the data, at creation:
CREATE TABLE orders (
order_id NUMBER,
order_status STRING CONSTRAINT orders_status_check CHECK (order_status IN ('NEW', 'SHIPPED', 'CANCELED'))
)
ERROR_LOGGING = TRUE;
How much gets recorded depends on the load's ON_ERROR setting:
ON_ERROR | What lands in the error table |
|---|---|
CONTINUE | Every rejected row |
SKIP_FILE (the Snowpipe default) | One error per file |
ABORT_STATEMENT (the COPY default) | Nothing |
So the useful pattern is a load that keeps going and records what it could not take:
COPY INTO orders
FROM @orders_stage/csv/
FILE_FORMAT = (TYPE = CSV)
ON_ERROR = CONTINUE;
Error logging works for standard and transient tables and for Snowflake-managed Iceberg tables, with CSV, JSON and Parquet files. It also applies to INSERT, UPDATE and MERGE on the same table.
Reading what was rejected
The rejected rows are read through ERROR_TABLE():
SELECT
error_metadata:details:file_name::STRING AS file_name,
error_metadata:details:row_number::NUMBER AS record_number,
error_metadata:error_message::STRING AS error_message,
COALESCE(error_data:"$1"::STRING, TO_JSON(error_data)) AS source_record
FROM ERROR_TABLE(orders)
WHERE error_metadata:service IN ('copy', 'snowpipe')
ORDER BY timestamp DESC;
That one query answers the question the finance team asks: which file, which row, what was wrong with it, and what it actually contained. Grouping by file and error code shows whether a load had one bad record or a systematic problem from a source system, and filtering on error code 100320 with a CHECK constraint message picks out the rows that broke a rule.
Because it is just a table function, you can put an alert on it, so rejections reach someone the same hour rather than at month end:
CREATE ALERT orders_load_errors_alert
WAREHOUSE = my_alert_wh
SCHEDULE = '60 MINUTE'
IF (EXISTS (
SELECT 1
FROM ERROR_TABLE(orders)
WHERE error_metadata:service IN ('copy', 'snowpipe')
))
THEN
CALL SYSTEM$SEND_EMAIL(
'my_email_int',
'first.last@example.com',
'The orders table has rejected rows',
'Query ERROR_TABLE(orders) to see the rows that loads rejected.');
Fixing and reloading
The rows are still there, so many can be corrected in SQL and inserted, without finding and re-staging the original file. A lower-case status that broke the CHECK, for example, can be upper-cased and reloaded, while rows that are genuinely wrong stay in the error table for someone to chase. Our companion repository has the full correct-and-reload query for CSV, taken from the Snowflake documentation.
When the rows have been dealt with, keep a copy for the audit trail and clear the table:
TRUNCATE ERROR_TABLE(orders);
That last step matters, because error tables are never purged automatically and their storage is billed at the normal rate.
The governance questions
This is where we would slow down before switching error logging on across a platform. An error table holds the original records, so it is personal data wherever the source table is.
- Masking does not apply to it. If masking, row access or projection policies are attached directly to the table or its columns, reading the error table needs the account-level
READ UNREDACTED ERROR TABLEprivilege, granted by ACCOUNTADMIN. Masking applied through tags does not trigger that check, so anyone who can read the error table sees the unmasked values. Treat theSELECT ERROR TABLEprivilege like access to the raw data. - It follows replication. Replicating the database copies the rejected source records to every replica account.
- It has no retention. Under POPIA you need a purpose and a retention period for personal data. Decide how long rejected rows are kept, and schedule the archive and truncate.
- Grants need thought.
ALLon a table now includesSELECT ERROR TABLE, so check who already has it.
The details that will catch you
CREATE OR REPLACE TABLEdrops the error table unless the new statement setsERROR_LOGGING = TRUEagain, and a clone starts with an empty one.- A CHECK constraint passes when its condition is NULL, so pair it with
NOT NULLwhere a value is required. - You cannot add a CHECK constraint to a table a pipe loads. Drop the pipe, add the constraint with
ENABLE NOVALIDATE, and recreate the pipe. - On a Snowflake-managed Iceberg table, a CHECK constraint makes writes from external engines fail.
- Only row-level errors are recorded. A file that cannot be read at all still shows up in
COPY_HISTORY, not the error table.
Where we would start
Pick the one load that causes the most month-end questions. Turn on error logging, change it to ON_ERROR = CONTINUE, add an alert, and agree who owns the rejected rows and how long they are kept. Then add CHECK constraints for the two or three rules the business actually cares about. It is a small change that turns "the load succeeded" into a statement you can back up.
The companion repository has a self-contained walkthrough with a sample file of deliberately bad rows. The script is written against Snowflake's documented syntax and linted in CI, and the README says what has and has not been run.
