{"record":{"id":"4284ab9a15300ece","repo":"dbt-labs/dbt-core","slug":"conversion-type-params-must-exist-for-conversion-m","errorCode":null,"errorMessage":"conversion_type_params must exist for conversion metric","messagePattern":"conversion_type_params must exist for conversion metric","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-parser/src/resolve/resolve_metrics.rs","lineNumber":503,"sourceCode":"                    .cumulative_type_params\n                    .clone()\n                    .unwrap_or_default()\n                    .metric;\n\n                if let Some(metric) = maybe_cumulative_metric {\n                    vec![metric.name]\n                } else {\n                    vec![]\n                }\n            }\n            MetricType::Conversion => {\n                if type_params.conversion_type_params.is_none() {\n                    vec![]\n                } else {\n                    let conversion_type_params = type_params\n                        .conversion_type_params\n                        .clone()\n                        .expect(\"conversion_type_params must exist for conversion metric\");\n                    let base_metric_name =\n                        conversion_type_params.base_metric.unwrap_or_default().name;\n                    let conversion_metric_name = conversion_type_params\n                        .conversion_metric\n                        .unwrap_or_default()\n                        .name;\n\n                    if base_metric_name.is_empty() || conversion_metric_name.is_empty() {\n                        vec![]\n                    } else {\n                        vec![base_metric_name, conversion_metric_name]\n                    }\n                }\n            }\n            _ => vec![],\n        };\n\n        let unique_ids_of_nodes_depends_on: Vec<String> = names_of_nodes_depends_on","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-parser/src/resolve/resolve_metrics.rs#L485-L521","documentation":"Panic \"conversion_type_params must exist for conversion metric\" fires in resolve_top_level_metrics when a conversion metric's type_params.conversion_type_params is Some at the guard but the cloned/checked value is unexpectedly None at unwrap time — practically, this occurs when metric type is conversion but conversion_type_params was cleared or mis-constructed between the check and the expect.","triggerScenarios":"Defining a metric with `type: conversion` whose conversion_type_params were dropped during deserialization (missing base_metric/conversion_metric fields) or mutated by config overrides before resolution.","commonSituations":"A conversion metric YAML missing required nested fields (window, base_metric, conversion_metric); schema changes in MetricTypeParams making the is_none guard stale.","solutions":["Validate the conversion metric's YAML: ensure conversion_type_params with base_metric and conversion_metric are present.","Replace the guard+expect with a single match/if-let that produces a proper schema error naming the metric.","Check for any code path between the guard and the expect that resets conversion_type_params to None."],"exampleFix":"// before\nif type_params.conversion_type_params.is_none() { vec![] } else {\n    let ctp = type_params.conversion_type_params.clone().expect(\"...\");\n// after\nmatch type_params.conversion_type_params.clone() {\n    Some(ctp) => { /* ... */ }\n    None => return Err(err![arg.ctxt, \"conversion metric '{}' missing conversion_type_params\", name]),\n}","handlingStrategy":"validation","validationCode":"# validate conversion metric YAML before dbt parse\n# metrics:\n#   - name: conv\n#     type: conversion\n#     type_params:\n#       conversion_type_params:\n#         base_metric: {name: base}\n#         conversion_metric: {name: conv_metric}\n#         window: {count: 7, period: day}\nassert 'conversion_type_params' in metric['type_params']","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always define base_metric, conversion_metric, and window for conversion metrics","Run dbt parse (schema check) before deeper pipelines","Prefer match over is_none-check + expect for Option fields"],"tags":["rust","metrics","panic","validation"],"backgroundTag":"missing-required-config-field","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"}