dbt-labs/dbt-core · critical

generic backend authentication

Error message

generic backend authentication

What it means

dbt-auth dispatches backend-specific authentication implementations via `auth_for_backend_with_warnings`, which matches on the requested `Backend` enum and constructs the corresponding auth object. The `Generic` backend variant has no authentication implementation, so the code panics with `unimplemented!` when it is requested. This is a deliberate placeholder marking an intentionally unimplemented feature, not a runtime condition the caller can recover from.

Source

Thrown at crates/dbt-auth/src/lib.rs:90

    warning_printer: Box<dyn AuthWarningPrinter>,
) -> Box<dyn Auth> {
    match backend {
        Backend::Snowflake => Box::new(snowflake::SnowflakeAuth::new(warning_printer)),
        Backend::Postgres => Box::new(postgres::PostgresAuth::new(warning_printer)),
        Backend::BigQuery => Box::new(bigquery::BigqueryAuth::new(warning_printer)),
        Backend::Databricks => Box::new(databricks::DatabricksAuth::new(warning_printer)),
        Backend::Redshift => Box::new(redshift::RedshiftAuth::new(warning_printer)),
        Backend::Salesforce => Box::new(salesforce::SalesforceAuth::new(warning_printer)),
        Backend::Spark => Box::new(spark::SparkAuth::new(warning_printer)),
        Backend::DuckDB | Backend::DuckDBExtended => {
            Box::new(duckdb::DuckDbAuth::new(backend, warning_printer))
        }
        Backend::LakeCompute => Box::new(lake_compute::LakeComputeAuth::new(warning_printer)),
        Backend::SQLServer => Box::new(sqlserver::SQLServerAuth::new(warning_printer)),
        Backend::ClickHouse => Box::new(clickhouse::ClickHouseAuth::new(warning_printer)),
        Backend::Athena => Box::new(athena::AthenaAuth::new(warning_printer)),
        Backend::Exasol => Box::new(exasol::ExasolAuth::new(warning_printer)),
        Backend::Generic { .. } => unimplemented!("generic backend authentication"),
    }
}

/// Error type for [dbt_auth].
///
/// For display purposes, it must be converted into an [AdapterError] first, outside of this crate.
#[derive(Debug)]
pub enum AuthError {
    /// Error from the [adbc_core] crate
    Adbc(adbc_core::error::Error),
    /// A generic configuration error
    Config(String),
    /// An error from the [serde_json] crate
    JSON(serde_json::Error),
    /// An error from the [dbt_yaml] crate
    YAML(dbt_yaml::Error),
    /// I/O error
    Io(io::Error),

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Do not use `Backend::Generic`; configure a concrete backend variant that has an auth implementation (e.g., Postgres, SQLServer, ClickHouse, Athena, etc.).
  2. If you need generic auth behavior, implement a `GenericAuth` type and add a match arm in `auth_for_backend_with_warnings` instead of relying on the `unimplemented!` placeholder.
  3. Check upstream/downstream adapter code to see why the backend resolved to `Generic` and fix the mapping so a supported backend is selected.

Example fix

// before
let backend = Backend::Generic { ... };
let auth = dbt_auth::auth_for_backend(backend, &printer)?; // panics
// after
let backend = Backend::SQLServer; // or another supported backend
let auth = dbt_auth::auth_for_backend(backend, &printer)?;
Defensive patterns

Strategy: type-guard

Validate before calling

fn assert_supported_backend(b: &Backend) -> Result<(), String> {
    match b {
        Backend::Generic { .. } => Err("Backend::Generic has no auth implementation; use a concrete backend".to_string()),
        _ => Ok(()),
    }
}

Type guard

fn is_supported_backend(b: &Backend) -> bool {
    !matches!(b, Backend::Generic { .. })
}

Try / catch

// Rust panics are not catchable in normal flow; guard before calling:
if matches!(backend, Backend::Generic { .. }) {
    return Err(AuthError::config("generic backend authentication is not supported"));
}
let auth = auth_for_backend(backend, printer)?;

Prevention

When it happens

Trigger: Calling `dbt_auth::auth_for_backend` (or `auth_for_backend_with_warnings`) with `Backend::Generic { .. }`. There is no configuration fix; any request resolving to the Generic backend variant reaches this match arm and panics.

Common situations: A profile or adapter configuration resolves to a generic backend (e.g., an adapter that declares itself generic rather than naming a concrete backend like Postgres, Snowflake, etc.), so auth selection falls through to the Generic arm. Developers wiring new adapters or testing backend dispatch may also hit it accidentally.

Understand the failure class

Related errors


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