{"record":{"id":"71d0e0275af1b440","repo":"dbt-labs/dbt-core","slug":"failed-to-create-relations-from-nodes","errorCode":null,"errorMessage":"Failed to create relations from nodes","messagePattern":"Failed to create relations from nodes","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/metadata/metadata_adapter.rs","lineNumber":134,"sourceCode":"            relevant_ids.insert(unique_id.clone());\n            // Include direct source parents from the parent map\n            let parents = &node.base().depends_on.nodes;\n            relevant_ids.extend(parents.iter().filter(|p| p.starts_with(\"source.\")).cloned());\n        }\n\n        relevant_ids\n            .iter()\n            .filter_map(|uid| resolved_state.nodes.get_node(uid))\n            .map(|node| {\n                create_relation(\n                    adapter_type,\n                    node.database(),\n                    node.schema(),\n                    Some(node.alias()),\n                    None,\n                    node.quoting(),\n                )\n                .expect(\"Failed to create relations from nodes\")\n                .into()\n            })\n            .collect()\n    }\n\n    /// Create schemas if they don't exist\n    #[allow(clippy::type_complexity)]\n    fn create_schemas_if_not_exists(\n        &self,\n        state: &State<'_, '_>,\n        catalog_schemas: Vec<(String, String, String)>,\n    ) -> AdapterResult<Vec<(String, String, String, AdapterResult<()>)>>;\n\n    // =========================================================================\n    // Async I/O methods - use _inner pattern for recording\n    // =========================================================================\n\n    /// List UDFs under a given set of catalog and schemas (implementation).","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/metadata/metadata_adapter.rs#L116-L152","documentation":"`create_relations_from_executed_nodes` (crates/dbt-adapter/src/metadata/metadata_adapter.rs:134) builds a relation from each executed node's database/schema/alias/quoting and calls `.expect(\"Failed to create relations from nodes\")`. The relation constructor is infallible in normal use, so a panic means the node produced a relation string the constructor rejects (e.g. invalid identifiers or incompatible quoting/database layout).","triggerScenarios":"Creating relations from executed model nodes whose database/schema/alias combine into an invalid or empty relation identifier, causing the relation constructor to return None/Err.","commonSituations":"Nodes with empty alias or schema due to config mistakes (e.g. missing schema in target/profile); identifiers containing characters the relation builder disallows; custom materializations that leave node fields unset.","solutions":["Inspect the failing node's database/schema/alias values for emptiness or invalid characters and fix the node config","Replace `.expect` with proper error propagation (`ok_or_else` -> AdapterError) so one bad node doesn't abort the whole batch","Validate relation identifiers before rendering SQL (quote/escape per warehouse rules)","Check the profile/target configuration that supplies database and schema defaults"],"exampleFix":"// before\n.expect(\"Failed to create relations from nodes\")\n// after\n.ok_or_else(|| AdapterError::new(\n    AdapterErrorKind::UnexpectedResult,\n    format!(\"failed to build relation for node {}\", node.name()),\n))?","handlingStrategy":"validation","validationCode":"// validate node parts before relation creation\nassert!(!node.database().is_empty() && !node.alias().is_empty(), \"node missing database/alias\");","typeGuard":"fn relation_parts_present(node: &ExecutedNode) -> bool {\n    !node.database().is_empty() && !node.alias().is_empty()\n}","tryCatchPattern":"std::panic::catch_unwind(AssertUnwindSafe(|| create_relations_from_executed_nodes(&nodes)))","preventionTips":["Validate database/schema/alias in node configs early","Check profile target supplies database and schema defaults","Escape/quote identifiers per warehouse rules","Fail fast with a clear error for empty node fields"],"tags":["rust","panic","relation","metadata"],"backgroundTag":"internal-invariant-violation","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"}