BigQuery error · Loading and schema
CSV table encountered too many errors, giving up
A CSV load job (or CSV external table) hit more bad rows than max_bad_records allows, 0 by default, so nothing was written. The message is only a summary: the cause is in the job's errors[] list, such as a header row, a stray quote, missing columns or a value that doesn't fit the column type.
The error message
Error while reading data, error message: CSV table encountered too many errors, giving up. Rows: <n>; errors: <n>. Please look into the errors[] collection for more details.
Causes
A header row loaded as data
Without skip_leading_rows = 1, the header becomes the first data row and fails to parse into numeric or date columns. Autodetect also misses headers when every column is a string.
Values that don't match the column type
The per-row error names the value and column, for example Could not parse '1.0' as int for field quantity (position 8) starting at location 25717. Typical culprits: decimals in INT64 columns, N/A or empty strings in numeric columns, and dates not in YYYY-MM-DD form, such as Could not parse '2024-04-13 00:00:00' as date.
Quotes, delimiters and embedded newlines
A quote in the middle of a field gives Data between close quote character (") and field separator. Fields with line breaks need allow_quoted_newlines; a wrong field_delimiter turns every row into one column.
Rows with missing or extra columns
CSV table references column position 6, but line starting at position:798 contains only 6 columns means a short (jagged) row. Extra trailing columns fail unless ignore_unknown_values is set.
Variants of the summary
Newer jobs word it as CSV processing encountered too many errors, giving up. Rows: 22; errors: 1; max bad: 0; error percent: 0, and older tools say Please look into the error stream. The fixes are the same.
How to fix it
1. Read the real errors
Run bq --format=prettyjson show -j JOB_ID and read status.errors, or open the job in the console. BigQuery returns at most five detailed errors per job, each with the byte offset of the bad line. For uncompressed files, gcloud storage cat --range=START-END gs://bucket/file.csv prints the bytes around that offset.
2. Set the CSV options that match the file
Skip the header, allow quoted newlines, and declare the date format if it isn't ISO.
LOAD DATA INTO `project.raw.orders`
FROM FILES (
format = 'CSV',
uris = ['gs://acme-landing/orders/2026-11-23.csv'],
skip_leading_rows = 1,
allow_quoted_newlines = TRUE,
date_format = 'DD/MM/YYYY'
);3. Load as strings, then convert in SQL
Load messy files into an all-STRING staging table so the load always succeeds, then convert with SAFE_CAST and keep the rejects visible.
SELECT
SAFE_CAST(order_id AS INT64) AS order_id,
SAFE_CAST(REPLACE(amount, ',', '') AS NUMERIC) AS amount,
SAFE.PARSE_DATE('%d/%m/%Y', order_date) AS order_date,
SAFE_CAST(REPLACE(amount, ',', '') AS NUMERIC) IS NULL AND amount IS NOT NULL AS amount_rejected
FROM `project.staging.orders_raw`;4. Allow a known number of bad rows, deliberately
max_bad_records (or --max_bad_records in bq load) skips up to that many bad rows. Skipped rows are dropped silently, so use it only with a reconciliation check on row counts.
How to prevent it
- Load with an explicit schema rather than autodetect for recurring files, so a changed file fails loudly instead of creating odd column types.
- Stop automatic retries of a failed file: failed load jobs still count toward the table's 1,500 daily modifications.
- Agree on a file contract with the producer (delimiter, quoting, date format, header) and validate it before loading.
FAQ
Is any data loaded when this error occurs?
No. A load job is atomic: if it fails, the destination table is unchanged. With max_bad_records set, the job succeeds and the bad rows are simply skipped.
Why does the error say errors: 1 when my file has many bad rows?
The default max_bad_records is 0, so the job gives up on the first bad row. Raise it temporarily on a test load to see up to five error details at once.
Does the failed load cost anything?
A failed load writes nothing, but it still counts toward load job limits for the table and project. Querying a CSV external table that fails this way is a failed query, which isn't billed on-demand.
Related
SQL reference
More loading and schema
All BigQuery error messages · What 50M daily events say about BigQuery failures
