hasura/graphql-engine · error · RelationshipError

The target data connector {data_connector_name} for relation

Error message

The target data connector {data_connector_name} for relationship {relationship_name} on type {type_name} does not support the variables capability

What it means

The relationship uses a foreach/variables-style mapping, but the data connector backing the target model does not support the `variables` capability, so the mapping cannot be pushed down to the connector.

Source

Thrown at v3/crates/metadata-resolve/src/stages/object_relationships/error.rs:111

    },
    #[error(
        "The target argument {argument_name} of command {command_name} has been mapped more than once in the relationship {relationship_name} on type {type_name}"
    )]
    CommandArgumentMappingExistsInRelationship {
        argument_name: ArgumentName,
        command_name: Qualified<CommandName>,
        relationship_name: RelationshipName,
        type_name: Qualified<CustomTypeName>,
    },
    #[error(
        "No mapping for target command argument {argument_name} in the relationship {relationship_name} on type {type_name}"
    )]
    MissingArgumentMappingInRelationship {
        type_name: Qualified<CustomTypeName>,
        argument_name: ArgumentName,
        relationship_name: RelationshipName,
    },
    #[error(
        "The target data connector {data_connector_name} for relationship {relationship_name} on type {type_name} does not support the variables capability"
    )]
    RelationshipTargetDoesNotSupportForEach {
        type_name: Qualified<CustomTypeName>,
        relationship_name: RelationshipName,
        data_connector_name: Qualified<DataConnectorName>,
    },
    #[error(
        "The target data connector {data_connector_name} for relationship {relationship_name} on type {type_name} has not defined any capabilities"
    )]
    NoRelationshipCapabilitiesDefined {
        type_name: Qualified<CustomTypeName>,
        relationship_name: RelationshipName,
        data_connector_name: Qualified<DataConnectorName>,
    },
    #[error(
        "The relationship {relationship_name} on type {type_name} defines an aggregate, but aggregates can only be used with array relationships, not object relationships"
    )]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Switch the target model to a data connector that supports the variables capability (e.g. a native database connector)
  2. Remove the foreach/variables-based mapping and use plain field mappings instead
  3. If you own the connector, implement and advertise the variables capability in its capabilities response

Example fix

// before
relationships:
  articles:
    target: { model: articles, connector: rest_connector }
    foreach_mapping: ...  # requires variables capability
// after
relationships:
  articles:
    target: { model: articles, connector: postgres }
    argument_mappings:
      author_id: id
Defensive patterns

Strategy: validation

Validate before calling

const caps = connectors[connectorName].capabilities ?? {};
if (rel.foreach_mapping && !caps.variables) {
  throw new Error(`connector ${connectorName} lacks variables capability`);
}

Try / catch

try { await applyMetadata(md); } catch (e) { if (/does not support the variables capability/.test(e.message)) { /* retarget connector or drop foreach */ } throw e; }

Prevention

When it happens

Trigger: Defining a foreach relationship (argument mappings over a list, i.e. nested/variables semantics) whose target model uses a data connector that lacks the variables capability.

Common situations: Using a custom or lightweight connector (e.g. a REST/GraphQL proxy connector) that never implemented variables; targeting a new connector without checking its capabilities response.

Related errors


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