dbt-labs/dbt-core · error

extension dispatch only yields csv as None, not TableFormat:

Error message

extension dispatch only yields csv as None, not TableFormat::Csv

What it means

Seed pre-registration dispatches on the file format: CSV seeds are handled earlier (as the None format case), while Parquet and other table formats spawn parquet registration. A TableFormat::Csv value reaching this match means the extension-to-format dispatch produced Csv twice — once converted to None and once passed through — which the dispatch contract forbids. The panic flags a broken format-mapping layer.

Source

Thrown at crates/dbt-tasks-sa/src/register_seeds.rs:257

                let type_ops = Arc::clone(&type_ops);
                handles.push(spawn_blocking_traced(move || {
                    register_seed_csv(seed, ctx, type_ops)
                }))
            }
            Some(TableFormat::Json) => {
                let type_ops = Arc::clone(&type_ops);
                handles.push(spawn_blocking_traced(move || {
                    register_seed_json(seed, ctx, type_ops)
                }))
            }
            Some(TableFormat::Parquet) => {
                let type_ops = Arc::clone(&type_ops);
                handles.push(spawn_traced(register_seed_parquet_async(
                    seed, ctx, type_ops,
                )))
            }
            Some(TableFormat::Csv) => {
                unreachable!("extension dispatch only yields csv as None, not TableFormat::Csv")
            }
        }
    }

    let mut results = Vec::with_capacity(handles.len());
    for handle in handles {
        match handle.await {
            Ok(Ok(registered)) => results.push(registered),
            // Emit the real error here (CSV parse failure, etc.). The seed's
            // visit_render will detect the missing schema and mark the task as
            // failed without emitting a second error.
            Ok(Err(e)) => tracing::error!("{}", e),
            Err(join_err) => {
                tracing::error!("Seed registration task panicked: {}", join_err)
            }
        }
    }
    results

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Fix the format detection/dispatch so CSV seed files resolve to None (handled by the csv path) rather than Some(TableFormat::Csv).
  2. Verify the extension-to-TableFormat mapping still special-cases csv before this match.
  3. If csv handling moves to this layer, replace the unreachable arm with a real csv registration branch.
  4. Check recently changed seed loading code for a duplicated format conversion.

Example fix

// before
Some(TableFormat::Csv) => unreachable!("extension dispatch only yields csv as None"),

// after
// in format detection: TableFormat mapping returns None for .csv so the csv branch handles it
"csv" => None, // csv seeds take the legacy csv registration path
Defensive patterns

Strategy: validation

Validate before calling

let fmt = detect_table_format(path);
debug_assert!(fmt != Some(TableFormat::Csv), "csv must map to None before pre_register_seeds");

Type guard

fn is_parquet_dispatchable(fmt: Option<TableFormat>) -> bool { !matches!(fmt, Some(TableFormat::Csv)) }

Try / catch

Some(TableFormat::Csv) => {
    log::warn!("csv reached parquet dispatch; falling back to csv registration");
    register_seed_csv(seed, ctx);
}

Prevention

When it happens

Trigger: Calling pre_register_seeds on a seed whose file extension maps to TableFormat::Csv but where the earlier `None` arm was not taken — i.e. the format resolver returned Some(TableFormat::Csv) instead of None for csv extensions.

Common situations: Modifying the seed-format detection code so csv files are classified as TableFormat::Csv at this layer; adding a new extension mapping that bypasses the csv-to-None conversion; upstream changes in the format/table-format detection crate.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/2c0f7f18fcc1ff8d. Report an issue: GitHub.