{"record":{"id":"6d9eb618dcfd4584","repo":"dbt-labs/dbt-core","slug":"get-temp-relation-path-relation-identifier-is-req","errorCode":null,"errorMessage":"get_temp_relation_path: relation.identifier is required","messagePattern":"get_temp_relation_path: relation\\.identifier is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/adapter/mod.rs","lineNumber":4178,"sourceCode":"                    .ok_or_else(|| {\n                        minijinja::Error::new(\n                            minijinja::ErrorKind::InvalidOperation,\n                            \"get_temp_relation_path: relation.database is required\",\n                        )\n                    })?;\n                let identifier = relation_val\n                    .get_attr(\"identifier\")\n                    .ok()\n                    .and_then(|v| {\n                        if v.is_undefined() || v.is_none() {\n                            None\n                        } else {\n                            v.as_str().map(|s| s.to_owned())\n                        }\n                    })\n                    .filter(|s| !s.is_empty())\n                    .ok_or_else(|| {\n                        minijinja::Error::new(\n                            minijinja::ErrorKind::InvalidOperation,\n                            \"get_temp_relation_path: relation.identifier is required\",\n                        )\n                    })?;\n                let path = self\n                    .get_temp_relation_path(&database, &identifier, batch_id)\n                    .map_err(minijinja::Error::from)?;\n                Ok(Value::from_object(path))\n            }\n            // major: int, minor: int\n            \"compare_dbr_version\" => self.compare_dbr_version(state, args),\n            // config: dict, model: dict, is_incremental: Optional[bool] = False\n            \"compute_external_path\" => self.compute_external_path(state, args),\n            // config: dict, tblproperties: Optional[dict] = None\n            \"update_tblproperties_for_uniform_iceberg\" => {\n                self.update_tblproperties_for_uniform_iceberg(state, args)\n            }\n            // config: dict","sourceCodeStart":4160,"sourceCodeEnd":4196,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/adapter/mod.rs#L4160-L4196","documentation":"An InvalidOperation minijinja error from get_temp_relation_path stating that `relation.identifier` is required. The callable derives a temp-relation path from database + identifier; a missing, null, empty, or non-string identifier makes path construction impossible, so the error is raised.","triggerScenarios":"Calling get_temp_relation_path with a relation whose `identifier` attribute is missing, None, an empty string, or not a string (e.g. a relation object built without an identifier, or attribute shadowed by a custom relation macro).","commonSituations":"Custom relation macros returning partially-built relations; unit-test fixtures constructing relations without identifiers; batch/incremental processing where an intermediate relation lost its identifier.","solutions":["Set a non-empty string identifier on the relation before calling (e.g. `this.identifier`).","Fix the macro/factory that builds the relation so identifier is always populated.","Guard the call site: skip or default the temp path when identifier is falsy.","Check quoting/rendering so identifier isn't rendered away before the call."],"exampleFix":"// before\n{% set rel = api.Relation.create(database=target.database) %}\n{% set path = get_temp_relation_path(rel, batch_id) %}\n// after\n{% set rel = api.Relation.create(database=target.database, identifier='my_table') %}\n{% set path = get_temp_relation_path(rel, batch_id) %}","handlingStrategy":"validation","validationCode":"{% if relation.identifier is not defined or not relation.identifier %}\n  {% do exceptions.raise_compiler_error('relation.identifier required for temp relation path') %}\n{% endif %}","typeGuard":"fn has_identifier(v: &Value) -> bool {\n    v.get_attr(\"identifier\").ok().and_then(|i| i.as_str().map(|s| !s.is_empty())).unwrap_or(false)\n}","tryCatchPattern":"match identifier { Some(id) if !id.is_empty() => ..., _ => Err(invalid_operation(\"relation.identifier is required\")) }","preventionTips":["Always supply identifier when calling api.Relation.create","Validate fixtures for unit tests include identifiers","Avoid custom relation macros that drop identifier"],"tags":["jinja","relation","temp-relation"],"backgroundTag":"empty-required-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"}