hasura/graphql-engine · error · NDCValidationError

collection {collection_name} is not defined in data connecto

Error message

collection {collection_name} is not defined in data connector {db_name}

What it means

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.

Source

Thrown at v3/crates/metadata-resolve/src/helpers/ndc_validation.rs:21

use crate::{
    data_connectors::CommandsResponseConfig,
    stages::{commands, data_connectors, models, object_types},
};
use ndc_models;
use open_dds::{
    commands::{CommandName, DataConnectorCommand, FunctionName, ProcedureName},
    data_connector::{
        CollectionName, DataConnectorColumnName, DataConnectorName, DataConnectorScalarType,
    },
    models::ModelName,
    types::{CustomTypeName, DataConnectorArgumentName, FieldName},
};

use crate::types::subgraph::{Qualified, QualifiedTypeName, QualifiedTypeReference};

#[derive(Debug, thiserror::Error)]
pub enum NDCValidationError {
    #[error("collection {collection_name} is not defined in data connector {db_name}")]
    NoSuchCollection {
        db_name: Qualified<DataConnectorName>,
        model_name: Qualified<ModelName>,
        collection_name: CollectionName,
    },
    #[error(
        "argument {argument_name} is not defined for collection {collection_name} in data connector {db_name}"
    )]
    NoSuchArgument {
        db_name: Qualified<DataConnectorName>,
        collection_name: CollectionName,
        argument_name: DataConnectorArgumentName,
    },
    #[error(
        "argument {argument_name} is not defined for function/procedure {func_proc_name} in data connector {db_name}"
    )]
    NoSuchArgumentForCommand {
        db_name: Qualified<DataConnectorName>,

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Verify the table/view exists in the underlying database with the exact name (and case) used in the model's collection name
  2. Refresh the connector's schema (restart connector or clear schema cache) so it picks up current tables
  3. Update the model's collection name in metadata to the current table name
  4. Check the connector's connection configuration targets the intended database/schema

Example fix

// before
"collections": [{ "name": "usr", ... }]
// after
"collections": [{ "name": "users", ... }]
Defensive patterns

Strategy: validation

Validate before calling

let schema = connector.get_schema().await?;
for model in models {
    assert!(schema.collections.iter().any(|c| c.name == model.collection_name),
        "collection {} missing in connector", model.collection_name);
}

Type guard

fn collection_exists(name: &CollectionName, s: &NdcSchema) -> bool {
    s.collections.iter().any(|c| &c.name == name)
}

Try / catch

Match NoSuchCollection and hint the user to verify the table exists and the connector points at the right database.

Prevention

When it happens

Trigger: 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.

Common situations: Database migrations renaming tables; different environments with different databases; connector config pointing to wrong DB; stale schema cache after DDL changes.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/992ac6a78ed072fa. Report an issue: GitHub.