{"record":{"id":"6103027392c74baa","repo":"dbt-labs/dbt-core","slug":"failed-to-get-parse-adapter","errorCode":null,"errorMessage":"Failed to get parse adapter","messagePattern":"Failed to get parse adapter","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-parser/src/resolve/resolve_sources.rs","lineNumber":414,"sourceCode":"        let user_quoting = DbtQuoting::merge_user(source.quoting.as_ref(), table.quoting.as_ref());\n\n        let mut table_quoting = user_quoting.unwrap_or_default();\n        table_quoting.default_to(&source_default_quoting);\n        let quoting_ignore_case = table_quoting.snowflake_ignore_case.unwrap_or(false);\n\n        let (database, schema, raw_identifier) =\n            resolve_relation_parts(&source, &table, &table_name, database);\n        let (database, schema, identifier, quoting) = normalize_quoting(\n            &table_quoting.try_into()?,\n            adapter_type,\n            &database,\n            &schema,\n            &raw_identifier,\n        );\n\n        let parse_adapter = jinja_env\n            .get_adapter()\n            .expect(\"Failed to get parse adapter\");\n\n        let relation_name =\n            generate_relation_name(parse_adapter, &database, &schema, &identifier, quoting)?;\n\n        let columns = if let Some(ref cols) = table.columns {\n            process_columns(\n                Some(cols),\n                source_config.meta.clone(),\n                source_config.tags.inner().clone().map(|tags| tags.into()),\n            )?\n        } else {\n            vec![]\n        };\n\n        // Validate local sources have data types defined\n        use dbt_schemas::schemas::common::SchemaOrigin;\n        if source_config.schema_origin == SchemaOrigin::Local {\n            if columns.is_empty() {","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-parser/src/resolve/resolve_sources.rs#L396-L432","documentation":"A panic from `jinja_env.get_adapter().expect(\"Failed to get parse adapter\")` while resolving source definitions. During source resolution the parser needs the adapter (database type/relation quoting rules) to call `generate_relation_name` for each source table. The Jinja environment is expected to always carry a parse-time adapter at this point; if it does not, this internal invariant is broken and the parser panics rather than silently generating malformed relation names.","triggerScenarios":"Calling `resolve_sources` with a `JinjaEnv` built without an adapter set (e.g. adapter not registered before resolution), an adapter lookup that returns None because the environment was constructed for a non-adapter context, or a plugin/extension replacing the Jinja environment with a bare one.","commonSituations":"Custom tooling invoking the parser library directly without wiring the parse adapter into the Jinja environment; an adapter crate/feature not enabled so no adapter is installed; ordering bugs where source resolution runs before adapter initialization; version mismatches between the parser and adapter crates.","solutions":["Ensure the parse adapter is installed on the JinjaEnv (via the env builder/`set_adapter`) before calling `resolve_sources`","Verify the correct adapter feature/crate for your warehouse is enabled and initialized (e.g. adapter plugin registration)","Check initialization order: adapter setup must precede any parsing/resolution pass","If using library APIs directly, use the env-construction helper that guarantees an adapter rather than building a bare JinjaEnv","Update parser and adapter crates to matching versions if a refactor changed where the adapter is stored"],"exampleFix":"// before\nlet jinja_env = JinjaEnv::new();\nresolve_sources(&jinja_env, ...)?;\n\n// after\nlet jinja_env = JinjaEnv::new();\njinja_env.set_adapter(parse_adapter.clone());\nresolve_sources(&jinja_env, ...)?;","handlingStrategy":"validation","validationCode":"// before resolution\nif jinja_env.get_adapter().is_none() {\n    return Err(anyhow::anyhow!(\"JinjaEnv has no parse adapter; install the adapter before resolving sources\"));\n}","typeGuard":null,"tryCatchPattern":"let result = std::panic::catch_unwind(|| resolve_sources(&jinja_env, ...));\nmatch result {\n    Ok(res) => res?,\n    Err(_) => anyhow::bail!(\"no parse adapter on JinjaEnv — ensure the adapter is registered before parsing\"),\n}","preventionTips":["Always register the parse adapter on the JinjaEnv before any resolve/parse pass","Enable and initialize the adapter crate matching your warehouse","Keep parser and adapter crates on matching versions","When using the library directly, prefer builder APIs that guarantee an adapter over bare env construction"],"tags":["rust","adapter","jinja","parser","initialization"],"backgroundTag":"missing-required-config","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"}