{"record":{"id":"def3e2489b0ec88f","repo":"dbt-labs/dbt-core","slug":"yaml-deserializes-into-config-type","errorCode":null,"errorMessage":"yaml deserializes into config type","messagePattern":"yaml deserializes into config type","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/dbt-parser/src/dbt_project_config.rs","lineNumber":1343,"sourceCode":"    {\n        // Diagnostics are emitted through the tracing layer, so capture them with a\n        // test consumer rather than a status reporter.\n        let (test_layer, _, _, log_records) = TestLayer::new();\n        let subscriber = create_tracing_subcriber_with_layer(\n            tracing::level_filters::LevelFilter::TRACE,\n            test_data_layer(\n                1,\n                None,\n                false,\n                std::iter::empty(),\n                std::iter::once(Box::new(test_layer) as ConsumerLayer),\n            ),\n            &[],\n        )\n        .expect(\"test tracing subscriber should be valid\");\n\n        let configs: S = dbt_jinja_utils::serde::from_yaml_raw(yaml, None, false, None)\n            .expect(\"yaml deserializes into config type\");\n\n        // The data layer only records events emitted within an active span, so run\n        // `init_project_config` inside a root span.\n        let result = tracing::subscriber::with_default(subscriber, || {\n            let _root = create_root_info_span(MockDynSpanEvent {\n                name: \"root\".to_string(),\n                flags: TelemetryOutputFlags::ALL,\n                ..Default::default()\n            })\n            .entered();\n\n            init_project_config::<T, S>(\n                &Some(configs),\n                Default::default(),\n                None,\n                disallow_plus_prefix,\n                AdapterType::Snowflake,\n            )","sourceCodeStart":1325,"sourceCodeEnd":1361,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-parser/src/dbt_project_config.rs#L1325-L1361","documentation":"A test-only `.expect()` asserting that the provided YAML successfully deserializes into the config struct type `S` (e.g. `ModelConfig`) via `dbt_jinja_utils::serde::from_yaml_raw`. If the YAML in a test case is malformed or incompatible with the config type, the test panics here instead of producing a comparison failure.","triggerScenarios":"Adding or editing a test case whose YAML block contains a key or value shape that doesn't match the target config struct, so `from_yaml_raw::<S>` returns Err and the expect panics.","commonSituations":"Test authoring mistakes: typo'd keys, values of the wrong type, or config schema changes (renamed/removed fields) that make existing fixture YAML invalid.","solutions":["Fix the YAML fixture so it matches the current schema of the target config struct","Check for recently renamed/removed config fields after upgrading and update fixtures accordingly","Convert the expect into an assertion with the deserialization error included so failures are readable","Validate the fixture against the struct's expected keys (+-prefixed keys under config) before running"],"exampleFix":"// before\nlet configs: S = from_yaml_raw(yaml, None, false, None).expect(\"yaml deserializes into config type\");\n\n// after\nlet configs: S = from_yaml_raw(yaml, None, false, None)\n    .unwrap_or_else(|e| panic!(\"fixture yaml invalid: {e}\"));","handlingStrategy":"validation","validationCode":"let configs: S = match from_yaml_raw(yaml, None, false, None) {\n    Ok(c) => c,\n    Err(e) => panic!(\"fixture yaml invalid: {e}\"),\n};","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep test YAML fixtures in sync with config struct schema changes","Use unwrap_or_else with the error message for readable test failures","Grep fixtures for renamed keys after config refactors"],"tags":["rust","yaml","serde","testing","fixture"],"backgroundTag":"yaml-parse-error","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"}