MetricSign
EN|NLRequest Access
Medium severityconfiguration

Power BI Refresh Error:
002003 (42S02)

What does this error mean?

A COPY INTO, INFER_SCHEMA, or stage-related command failed because the referenced file format object does not exist in the current database or schema.

Common causes

  • 1The file format was created in a different database or schema than the one currently in use
  • 2The file format was dropped as part of a schema cleanup and not recreated
  • 3The fully qualified name is misspelled (database.schema.format_name)
  • 4The role executing the query lacks USAGE privilege on the file format object

How to fix it

  1. 1Step 1: Run SHOW FILE FORMATS IN SCHEMA your_db.your_schema to list available formats.
  2. 2Step 2: If the format does not exist, recreate it with CREATE FILE FORMAT including all required options.
  3. 3Step 3: Qualify the format name fully in your command: FORMAT_NAME = 'your_db.your_schema.your_format'.
  4. 4Step 4: Grant usage: GRANT USAGE ON FILE FORMAT your_format TO ROLE your_role.

Frequently asked questions

Can I use a file format from a different database in COPY INTO?

Yes, by using the fully qualified three-part name: database.schema.format_name. Ensure the running role has USAGE on the database and schema that owns the format.

Are file formats version-controlled or managed by dbt?

Not natively. Many teams manage file format DDL in a dbt macro or a separate migrations script. Consider adding file format definitions to your dbt project's macros/setup.sql or a dedicated on-run-start macro.

Other configuration errors