{"record":{"id":"8c98b913eb8db17c","repo":"dbt-labs/dbt-core","slug":"validated-above","errorCode":null,"errorMessage":"validated above","messagePattern":"validated above","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-auth/src/snowflake/mod.rs","lineNumber":524,"sourceCode":"                                \"Snowflake keypair authentication requires 'user'.\",\n                            ));\n                        }\n                        if config.contains_key(\"password\") {\n                            warn_ignored_auth_field(warning_printer, \"keypair\", \"password\");\n                        }\n\n                        // We found a passphrase, so we MUST find a key source to go with it\n                        let path = config.get_str(\"private_key_path\");\n                        let raw = config.get_str(\"private_key\");\n\n                        match (path, raw) {\n                            (Some(p), _) => Ok(SnowflakeAuthIR::KeypairPath {\n                                user: config.get_str(\"user\").expect(\"validated above\"),\n                                path: p,\n                                passphrase: Some(value),\n                            }),\n                            (None, Some(r)) => Ok(SnowflakeAuthIR::KeypairInline {\n                                user: config.get_str(\"user\").expect(\"validated above\"),\n                                private_key: r,\n                                passphrase: Some(value),\n                            }),\n                            (None, None) => Err(AuthError::config(\n                                \"Found 'private_key_passphrase' but missing 'private_key_path' or 'private_key'\",\n                            )),\n                        }\n                    }\n                    \"oauth_client_id\" | \"oauth_client_secret\" => {\n                        // TODO(versusfacit): reenable warnings when possible\n                        // if config.contains_key(\"user\") {\n                        //     warn_ignored_auth_field(warning_printer, \"OAuth\", \"user\");\n                        // }\n                        // if config.contains_key(\"password\") {\n                        //     warn_ignored_auth_field(warning_printer, \"OAuth\", \"password\");\n                        // }\n\n                        let cid = config.get_str(\"oauth_client_id\");","sourceCodeStart":506,"sourceCodeEnd":542,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-auth/src/snowflake/mod.rs#L506-L542","documentation":"This is a Rust panic from `.expect(\"validated above\")` on `config.get_str(\"user\")` while building `SnowflakeAuthIR::KeypairPath`/`KeypairInline` in the Snowflake keypair auth parser. The library asserts that an earlier validation step guaranteed the `user` key exists; if the invariant is broken the thread panics instead of returning an `AuthError`. It is an internal-invariant assertion, not a user-facing error message.","triggerScenarios":"Calling `SnowflakeAuth::configure` (or the IR parser) with a snowflake keypair config where `private_key_path`/`private_key`/`private_key_passphrase` validation succeeds but the `user` key is absent or not a string — i.e. a code path where validation and extraction disagree (e.g. `user` present as a non-string YAML value).","commonSituations":"Config mistakes: `user` omitted or typed as a number/null in profiles.yml while using `method: keypair` with `private_key_path` or inline `private_key`; downstream code in dbt-core sending an AdapterConfig with user nested under a different key.","solutions":["Add a `user` key (as a plain string) to the snowflake profile config before calling configure","Check for a library bug where the validation branch for this authenticator does not actually check `user`; report/patch the mismatch","Upgrade dbt-auth — newer versions may return `AuthError::config(\"... requires 'user'\")` instead of panicking"],"exampleFix":"// before\ncfg = {\"method\": \"keypair\", \"private_key_path\": \"/k.p8\", \"private_key_passphrase\": \"x\"}\n// after\ncfg = {\"method\": \"keypair\", \"user\": \"MY_USER\", \"private_key_path\": \"/k.p8\", \"private_key_passphrase\": \"x\"}","handlingStrategy":"validation","validationCode":"let user = config.get_str(\"user\").ok_or_else(|| AuthError::config(\"Snowflake keypair auth requires 'user'.\"))?;","typeGuard":"fn has_str(config: &AdapterConfig, key: &str) -> bool { config.get_str(key).is_some() }","tryCatchPattern":null,"preventionTips":["Always include a string `user` in snowflake profiles using keypair auth","Quote numeric usernames in YAML so they parse as strings","Pin dbt-auth versions where keypair validation covers `user`"],"tags":["rust","panic","snowflake","config-validation"],"backgroundTag":"internal-invariant-violation","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}