dbt-labs/dbt-core · error
owner key in config.meta
Error message
owner key in config.meta
What it means
Assertion "owner key in config.meta" panics when the patched macro's `config.meta` map lacks the "owner" key in test_apply_macro_patches_populates_config_meta_and_docs. It verifies that macro patch metadata is merged into the macro's resolved config.meta.
Source
Thrown at crates/dbt-parser/src/resolve/resolve_macros.rs:949
apply_macro_patches(
&mut macros,
¯o_properties,
"test_pkg",
&jinja_env,
&base_ctx,
None,
false,
)?;
let patched = macros.get(&unique_id).expect("macro still present");
// config.meta mirrors the patched meta
let owner = patched
.config
.meta
.get("owner")
.expect("owner key in config.meta");
assert_eq!(owner.as_str(), Some("alice"));
// config.docs mirrors the patched docs (show: false)
assert!(
!patched.config.docs.show,
"config.docs.show should be false"
);
Ok(())
}
#[test]
fn typecheck_macros_isolates_panic_and_still_populates_other_macros() -> FsResult<()> {
use minijinja::compiler::typecheck::FunctionRegistry;
use minijinja::machinery::Span as MinijinjaSpan;
use minijinja::{Argument, DynTypeObject, Environment, Type, UserDefinedFunctionType};
fn make_macro(unique_id: &str, sql: &str) -> DbtMacro {View on GitHub (pinned to 0267ce9170)
Solutions
- Verify the fixture YAML declares `config: meta: owner: alice` under the patched macro.
- Inspect apply_macro_patches' config-merge step to confirm meta is copied into the macro's config rather than discarded.
- Dump `patched.config.meta` in the test to see which keys actually landed.
Example fix
// before
macros:
- name: my_macro
patches:
// after
macros:
- name: my_macro
config:
meta:
owner: alice Defensive patterns
Strategy: validation
Validate before calling
// validate fixture YAML before running the parser assert!(yaml["config"]["meta"]["owner"].is_some(), "fixture must set config.meta.owner");
Prevention
- Keep patch fixtures' config.meta blocks explicit
- After meta schema changes, round-trip fixtures through serde in a test
- Dump merged config.meta on failure for diagnosis
When it happens
Trigger: The YAML fixture for the macro patch omits `config: meta: owner: alice`, or apply_macro_patches drops config.meta during merge, causing `.get("owner")` to return None.
Common situations: Fixture YAML edited so the meta block moved under a wrong key; a serializer/deserializer change (e.g., MetaValue flattening) stops "owner" from round-tripping into config.meta.
Related errors
- macro still present
- when data_type is date, inner must be a TimeConfig
- The `start_paused` option requires the `current_thread` runt
- The `unhandled_panic` option requires the `current_thread` r
- Failed to parse value of `{field}` as integer: {e}
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/5e2f65e1bfa3a557.
Report an issue: GitHub.