{"record":{"id":"f71f288f3478653f","repo":"dbt-labs/dbt-core","slug":"valid-utf-8-path","errorCode":null,"errorMessage":"Valid UTF-8 path","messagePattern":"Valid UTF-8 path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/dbt-auth/src/snowflake/mod.rs","lineNumber":1141,"sourceCode":"                snowflake::JWT_PRIVATE_KEY_PKCS8_VALUE,\n                expected_pem.as_str(),\n            ),\n            (snowflake::AUTH_TYPE, \"auth_jwt\"),\n            (snowflake::APPLICATION_NAME, APP_NAME),\n            (snowflake::LOG_TRACING, \"fatal\"),\n            (snowflake::REQUEST_TIMEOUT, DEFAULT_REQUEST_TIMEOUT),\n        ];\n        run_config_test(config, &expected);\n    }\n\n    #[test]\n    fn test_keypair_path_with_method_param() {\n        use std::io::Write;\n        use tempfile::NamedTempFile;\n\n        let mut tmp_file = NamedTempFile::new().expect(\"Failed to create temp file\");\n        writeln!(tmp_file, \"fake-private-key-data\").unwrap();\n        let temp_path = tmp_file.path().to_str().expect(\"Valid UTF-8 path\");\n\n        let mut config = base_config_without_password();\n        config.insert(\"method\".into(), \"keypair\".into());\n        config.insert(\"private_key_path\".into(), temp_path.into());\n        let expected = [\n            (\"user\", \"U\"),\n            (\"password\", ADBC_STUB_PASSWORD),\n            (snowflake::ACCOUNT, \"A\"),\n            (snowflake::ROLE, \"role\"),\n            (snowflake::WAREHOUSE, \"warehouse\"),\n            (snowflake::JWT_PRIVATE_KEY, temp_path),\n            (snowflake::AUTH_TYPE, \"auth_jwt\"),\n            (snowflake::APPLICATION_NAME, APP_NAME),\n            (snowflake::LOG_TRACING, \"fatal\"),\n            (snowflake::REQUEST_TIMEOUT, DEFAULT_REQUEST_TIMEOUT),\n        ];\n        run_config_test(config, &expected);\n    }","sourceCodeStart":1123,"sourceCodeEnd":1159,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-auth/src/snowflake/mod.rs#L1123-L1159","documentation":"Test panic from `tmp_file.path().to_str().expect(\"Valid UTF-8 path\")` in `test_keypair_path_with_method_param`. It fires only if the OS-provided temporary file path is not valid UTF-8, which the test then stores into the config as a String. Practically a platform/environment edge case rather than an auth-logic failure.","triggerScenarios":"Running the test on a system whose temp directory path (from TMPDIR or the OS default) contains non-UTF-8 bytes — e.g. a TMPDIR with non-ASCII/invalid-encoding bytes on Linux.","commonSituations":"Environments with unusual TMPDIR values, locales with non-UTF-8 encodings, or container mounts with odd path names.","solutions":["Set TMPDIR to a plain ASCII path (e.g. /tmp) before running the tests","Verify locale/encoding settings (LANG/LC_ALL as UTF-8)","If paths must be arbitrary, refactor the test/config to use PathBuf instead of str"],"exampleFix":"// before\nTMPDIR=\"/tmp/ünïcødé\" cargo test -p dbt-auth\n// after\nexport TMPDIR=/tmp && cargo test -p dbt-auth test_keypair_path_with_method_param","handlingStrategy":"type-guard","validationCode":"let p = tmp_file.path();\nassert!(p.to_str().is_some(), \"temp path not UTF-8: {:?}\", p);","typeGuard":"fn is_utf8_path(p: &std::path::Path) -> bool { p.to_str().is_some() }","tryCatchPattern":null,"preventionTips":["Set TMPDIR to an ASCII path in CI and dev environments","Use UTF-8 locales (LANG=C.UTF-8)","Prefer PathBuf over String for paths in library APIs"],"tags":["rust","tests","filesystem","utf-8"],"backgroundTag":"invalid-argument-format","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}