MetricSign
EN|NLRequest Access
High severitydata loading

Power BI Refresh Error:
COPY INTO Column Count Mismatch

What does this error mean?

A COPY INTO command failed because the number of columns in the source file does not match the number of columns in the target table (or the explicit column list provided).

Common causes

  • 1Source CSV or Parquet file has more or fewer columns than the target table
  • 2Column list in the COPY INTO statement does not match the file's field count
  • 3Schema of the target table was changed (column added or dropped) without updating the file format or pipeline
  • 4File generated with a different delimiter or quoting that causes incorrect column parsing
  • 5Using a named file format with an outdated SKIP_HEADER setting that misaligns column positions

How to fix it

  1. 1Run `SELECT $1,$2,... FROM @stage/file.csv (FILE_FORMAT => ...)` to count the actual columns in the file
  2. 2Compare with `DESCRIBE TABLE <table>` to find the mismatch
  3. 3If the file has extra columns, use a column mapping in COPY INTO: `COPY INTO t (col1, col2) FROM (SELECT $1, $3 FROM @stage/file.csv)`
  4. 4If the table has extra columns, add DEFAULT values or allow NULLs for the missing file columns
  5. 5Update the pipeline to regenerate files with the correct schema after any table schema change

Frequently asked questions

Can COPY INTO handle files where some columns are optional?

Yes — use the `COPY INTO ... FROM (SELECT $1, $2, NULL FROM @stage/file)` pattern to supply NULL for missing source columns, provided the target column allows NULLs.

How do I set ON_ERROR to skip bad files instead of failing?

Add `ON_ERROR = CONTINUE` or `ON_ERROR = SKIP_FILE` to the COPY INTO statement. `CONTINUE` loads valid rows and skips bad ones; `SKIP_FILE` skips entire files with errors.

Other data loading errors