dbt-labs/dbt-core · error

configure

Error message

configure

What it means

Test panic from `.configure(&AdapterConfig::new(config)).expect("configure")` in the `thrift_auth_ok` test of `SparkAuth`. It panics when `SparkAuth::configure` returns an `Err` for one of the thrift auth method fixtures (e.g. LDAP, Kerberos variants), unwrapping the underlying `AuthError` message into the panic. This is a regression guard, not production behavior.

Source

Thrown at crates/dbt-auth/src/spark/mod.rs:425

        for (auth, option, extra_keys) in cases {
            let config = Mapping::from_iter(
                [
                    ("host".into(), "myhost".into()),
                    ("method".into(), "thrift".into()),
                    ("auth".into(), auth.into()),
                ]
                .into_iter()
                .chain(
                    extra_keys
                        .iter()
                        .map(|(k, v)| ((*k).to_string().into(), (*v).to_string().into())),
                ),
            );

            let builder = SparkAuth::new(Box::new(crate::NoopAuthWarningPrinter))
                .configure(&AdapterConfig::new(config))
                .expect("configure");

            assert_eq!(other_option_value(&builder, spark::AUTH_TYPE), Some(option));
        }
    }

    #[test]
    fn thrift_auth_err() {
        let config = Mapping::from_iter([
            ("host".into(), "myhost".into()),
            ("method".into(), "thrift".into()),
            ("auth".into(), "invalid".into()),
        ]);
        let err = SparkAuth::new(Box::new(crate::NoopAuthWarningPrinter))
            .configure(&AdapterConfig::new(config))
            .expect_err("configure should fail");
        assert_eq!(err.msg(), "invalid 'auth' for Spark Thrift");
    }

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Read the wrapped AuthError message from the panic to see which key/value configure rejected
  2. Restore acceptance of the fixture in the spark thrift parser/validation
  3. If the rejection is intentional, update the thrift_auth_ok fixture list to match the new contract

Example fix

// before
Err(AuthError::config("unsupported auth type"))
// after: accept the fixture or update it
config.insert("auth".into(), "LDAP".into()); // matches supported auth enum
Defensive patterns

Strategy: try-catch

Validate before calling

// fixture-level guard
assert!(SUPPORTED_THRIFT_AUTHS.contains(&auth.as_str()), "unsupported auth: {auth}");

Try / catch

let builder = spark_auth.configure(&AdapterConfig::new(config)).unwrap_or_else(|e| panic!("configure failed: {e}"));

Prevention

When it happens

Trigger: Modifying Spark auth validation/extraction so a previously-valid thrift auth config fixture (method: thrift with an `auth` value) is now rejected by configure.

Common situations: Developers renaming spark auth option keys (AUTH_TYPE etc.), adding required fields, or tightening enum validation for thrift auth types run `cargo test -p dbt-auth` and hit this panic.

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/54b919327355d20e. Report an issue: GitHub.