{"record":{"id":"c3e66b5f0f34616c","repo":"dbt-labs/dbt-core","slug":"no-bigquery-type-in-field-metadata-this-is-a-dr","errorCode":null,"errorMessage":"No 'BIGQUERY:type' in field metadata. This is a driver bug.","messagePattern":"No 'BIGQUERY:type' in field metadata\\. This is a driver bug\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/relation/bigquery/config/components/partition_by.rs","lineNumber":47,"sourceCode":"        to_jinja_fn: to_jinja,\n        value: cfg,\n    }\n}\n\nfn from_remote_state(schema: &Schema) -> AdapterResult<PartitionBy> {\n    let metadata = &schema.metadata;\n    let time_partition = if let Some(partition) = metadata.get(\"TimePartitioning.Field\") {\n        let field_name = partition.parse::<String>().unwrap();\n\n        let data_type = schema\n            .fields()\n            .find(&field_name)\n            .map(|(_, field)| {\n                dbt_adapter_sql::types::original_type_string(\n                    dbt_adapter_core::AdapterType::Bigquery,\n                    field,\n                )\n                .expect(\"No 'BIGQUERY:type' in field metadata. This is a driver bug.\")\n                .to_string()\n            })\n            .expect(\"BigQuery returned invalid 'TimePartitioning.Field'. This is a driver bug.\");\n\n        Some(BigqueryPartitionConfig {\n            field: field_name,\n            data_type,\n            __inner__: BigqueryPartitionConfigInner::Time(TimeConfig {\n                granularity: metadata.get(\"TimePartitioning.Type\").unwrap().to_string(),\n                time_ingestion_partitioning: false,\n            }),\n            // TODO(serramatutu): how do we determine the value of this?\n            copy_partitions: false,\n        })\n    } else {\n        None\n    };\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/relation/bigquery/config/components/partition_by.rs#L29-L65","documentation":"When reconstructing BigQuery partition config from a remote table's Arrow schema metadata, the code finds the TimePartitioning.Field and calls original_type_string(Bigquery, field), which requires each field to carry a 'BIGQUERY:type' metadata entry. If the field lacks that metadata, the mapping returns None and this .expect panics, asserting that the driver that produced the schema forgot to attach BigQuery type metadata — a driver bug, not user error.","triggerScenarios":"Calling from_remote_state (directly or via from_remote_state_no_labels / from_remote_state_with_labels) on a schema where a field named by 'TimePartitioning.Field' exists but has no 'BIGQUERY:type' entry in its field metadata — typically when a non-BigQuery driver or a hand-built Arrow schema is passed through the BigQuery remote-state path.","commonSituations":"Using a mocked or cached schema built without driver metadata; a driver upgrade that stopped emitting 'BIGQUERY:type'; passing a view/materialized-view schema from a different adapter backend into BigQuery relation reconciliation.","solutions":["Confirm the schema came from the BigQuery driver and that it attaches 'BIGQUERY:type' to every field; re-fetch the schema from the live API.","Inspect field.metadata() for the partitioning field and check which key it actually carries (e.g. a renamed metadata key after a driver update) — align the key with what the driver emits.","Pin/upgrade dbt BigQuery driver/adapter components to matching versions so metadata emission and consumption agree.","If you construct schemas in tests/tools, add metadata \"BIGQUERY:type\" to the partitioning field before calling from_remote_state."],"exampleFix":"// before\n.expect(\"No 'BIGQUERY:type' in field metadata. This is a driver bug.\")\n// after\n.ok_or_else(|| AdapterError::new(AdapterErrorKind::Internal,\n    format!(\"field '{field_name}' missing BIGQUERY:type metadata\")))?","handlingStrategy":"validation","validationCode":"fn has_bq_type(schema: &arrow_schema::Schema, field_name: &str) -> bool {\n    schema.fields().find(field_name)\n        .map(|(_, f)| f.metadata().contains_key(\"BIGQUERY:type\"))\n        .unwrap_or(false)\n}\n// check before from_remote_state / relation reconciliation","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always obtain schemas through the BigQuery driver, which attaches 'BIGQUERY:type' metadata","Don't mix schemas from other adapters into BigQuery relation reconciliation","After driver upgrades, diff emitted field metadata keys against what the adapter expects","In tests, build schemas with the required BIGQUERY:type metadata on every field"],"tags":["bigquery","metadata","driver","panic"],"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-14T11:17:12.474Z"}