hasura/graphql-engine · error · ArgumentPresetExecutionError

Model source not found for model '{model_name}'

Error message

Model source not found for model '{model_name}'

What it means

Thrown when the planner resolves argument presets for a model but cannot find any data source (model source) registered under the requested model name. It is part of ArgumentPresetExecutionError in the plan crate and indicates the model exists in name only, with no backing source in the metadata/catalog. The Qualified<ModelName> in the variant names exactly which model failed resolution.

Source

Thrown at v3/crates/plan/src/query/arguments.rs:378

        expected_type: QualifiedTypeReference,
    },
    #[error("expected {expected_type} but got a string")]
    GotString {
        expected_type: QualifiedTypeReference,
    },
    #[error("expected {expected_type} but got an object")]
    GotObject {
        expected_type: QualifiedTypeReference,
    },
    #[error("expected {expected_type} but got an array")]
    GotArray {
        expected_type: QualifiedTypeReference,
    },
    #[error(
        "could not convert the provided header value to string as it contains non-visible ASCII characters"
    )]
    IllegalCharactersInHeaderValue,
    #[error("Model source not found for model '{model_name}'")]
    ModelSourceNotFound { model_name: Qualified<ModelName> },
    #[error("Model permissions for model {model_name} not found for role {role}")]
    ModelArgumentPresetsNotFound {
        role: Role,
        model_name: Qualified<ModelName>,
    },
    #[error("command {command_name} does not have a source defined")]
    CommandSourceNotFound {
        command_name: Qualified<CommandName>,
    },
    #[error("command permissions for command {command_name} not found for role {role}")]
    CommandArgumentPresetsNotFound {
        command_name: Qualified<CommandName>,
        role: Role,
    },
    #[error("argument mapping not found for {argument_name}")]
    ArgumentMappingNotFound { argument_name: ArgumentName },
    #[error("type mapping not found for object {object_type_name}")]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Verify the model exists in the current metadata and has a source configured (check the model -> source relationship in your metadata file)
  2. Confirm the Qualified<ModelName> (subgraph + name) in the failing query matches the qualified name in metadata exactly
  3. Rebuild/reload metadata so the planner sees the model source binding
  4. If the source was removed intentionally, update or remove queries referencing that model

Example fix

// before (metadata)
{ "models": { "users": { "relationships": {} } } }
// after
{ "models": { "users": { "source": { "dataConnector": "pg", "collection": "users" } } } }
Defensive patterns

Strategy: validation

Validate before calling

// Before planning, confirm the model has a source in resolved metadata
fn model_has_source(metadata: &Metadata, name: &Qualified<ModelName>) -> bool {
    metadata.models.get(name).map(|m| m.source.is_some()).unwrap_or(false)
}

Type guard

fn is_model_source_not_found(e: &ArgumentPresetExecutionError) -> bool {
    matches!(e, ArgumentPresetExecutionError::ModelSourceNotFound { .. })
}

Try / catch

// In Rust, prefer matching the variant rather than catching:
match result {
    Err(PlanError::Arguments(e @ ArgumentPresetExecutionError::ModelSourceNotFound { model_name })) => {
        return bad_request(format!("unknown model source: {model_name}"));
    }
    other => other,
}

Prevention

When it happens

Trigger: Planning a query that references a model (e.g. selecting from it or using it as a command target) when the model's source is absent from the resolved metadata — typically because the model was renamed, its source was removed, or the metadata was built from a stale subset.

Common situations: Renaming a model in metadata without updating NDC configuration; a data connector source not being attached to the model; version upgrades where model-source linking moved from implicit to explicit; partial metadata loads that skip the sources section.

Related errors


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