{"record":{"id":"992ac6a78ed072fa","repo":"hasura/graphql-engine","slug":"collection-collection-name-is-not-defined-in-dat","errorCode":null,"errorMessage":"collection {collection_name} is not defined in data connector {db_name}","messagePattern":"collection (.+?) is not defined in data connector (.+?)","errorType":"validation","errorClass":"NDCValidationError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/helpers/ndc_validation.rs","lineNumber":21,"sourceCode":"use crate::{\n    data_connectors::CommandsResponseConfig,\n    stages::{commands, data_connectors, models, object_types},\n};\nuse ndc_models;\nuse open_dds::{\n    commands::{CommandName, DataConnectorCommand, FunctionName, ProcedureName},\n    data_connector::{\n        CollectionName, DataConnectorColumnName, DataConnectorName, DataConnectorScalarType,\n    },\n    models::ModelName,\n    types::{CustomTypeName, DataConnectorArgumentName, FieldName},\n};\n\nuse crate::types::subgraph::{Qualified, QualifiedTypeName, QualifiedTypeReference};\n\n#[derive(Debug, thiserror::Error)]\npub enum NDCValidationError {\n    #[error(\"collection {collection_name} is not defined in data connector {db_name}\")]\n    NoSuchCollection {\n        db_name: Qualified<DataConnectorName>,\n        model_name: Qualified<ModelName>,\n        collection_name: CollectionName,\n    },\n    #[error(\n        \"argument {argument_name} is not defined for collection {collection_name} in data connector {db_name}\"\n    )]\n    NoSuchArgument {\n        db_name: Qualified<DataConnectorName>,\n        collection_name: CollectionName,\n        argument_name: DataConnectorArgumentName,\n    },\n    #[error(\n        \"argument {argument_name} is not defined for function/procedure {func_proc_name} in data connector {db_name}\"\n    )]\n    NoSuchArgumentForCommand {\n        db_name: Qualified<DataConnectorName>,","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/helpers/ndc_validation.rs#L3-L39","documentation":"NDCValidationError::NoSuchCollection means the metadata references a collection by name that the data connector's schema does not contain. Collections correspond to the connector's tables/views; when resolving a model to an NDC collection, the resolver verifies the collection exists in the connector's schema response and throws this with the db_name, model_name, and collection_name.","triggerScenarios":"A model whose data source is a data connector whose /schema response lacks the named collection; table renamed or dropped in the database; connector configured against a different database/schema; case-sensitivity mismatch in collection names.","commonSituations":"Database migrations renaming tables; different environments with different databases; connector config pointing to wrong DB; stale schema cache after DDL changes.","solutions":["Verify the table/view exists in the underlying database with the exact name (and case) used in the model's collection name","Refresh the connector's schema (restart connector or clear schema cache) so it picks up current tables","Update the model's collection name in metadata to the current table name","Check the connector's connection configuration targets the intended database/schema"],"exampleFix":"// before\n\"collections\": [{ \"name\": \"usr\", ... }]\n// after\n\"collections\": [{ \"name\": \"users\", ... }]","handlingStrategy":"validation","validationCode":"let schema = connector.get_schema().await?;\nfor model in models {\n    assert!(schema.collections.iter().any(|c| c.name == model.collection_name),\n        \"collection {} missing in connector\", model.collection_name);\n}","typeGuard":"fn collection_exists(name: &CollectionName, s: &NdcSchema) -> bool {\n    s.collections.iter().any(|c| &c.name == name)\n}","tryCatchPattern":"Match NoSuchCollection and hint the user to verify the table exists and the connector points at the right database.","preventionTips":["Apply migrations before deploying metadata that references new tables","Use the same DB schema across environments (or validate per-env)","Refresh connector schema after DDL"],"tags":["ndc","collection","data-connectors","schema-validation"],"backgroundTag":"table-not-found","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}