hasura/graphql-engine · error · BooleanExpressionError::RemoteComparableRelationshipWithArgumentMappingTargetNotSupported

The relationship '{relationship_name}' cannot be used as a c

Error message

The relationship '{relationship_name}' cannot be used as a comparable relationship in boolean expression type '{boolean_expression_type_name}' because it is a remote relationship with an argument mapping target. Relationship '{relationship_name}' on type '{source_type}' has source field '{source_field}' mapped to target argument '{target_argument}'

What it means

A relationship used as a comparable/filterable relationship inside a boolean expression type is a remote relationship whose source field maps to a target argument. Argument-mapped remote relationships cannot be used inside filter expressions, so resolution rejects them.

Source

Thrown at v3/crates/metadata-resolve/src/stages/boolean_expressions/error.rs:190

        "Model {model:} has source data connector {model_data_connector:} but its filter expression type {filter_expression_type:} is backed by data connector {filter_expression_data_connector:}"
    )]
    DifferentDataConnectorInFilterExpression {
        model: Qualified<ModelName>,
        model_data_connector: Qualified<DataConnectorName>,
        filter_expression_type: Qualified<CustomTypeName>,
        filter_expression_data_connector: Qualified<DataConnectorName>,
    },
    #[error(
        "Model {model:} has source data connector object type {model_data_connector_object_type:} but its filter expression type {filter_expression_type:} is backed by data connector {filter_expression_data_connector_object_type:}"
    )]
    DifferentDataConnectorObjectTypeInFilterExpression {
        model: Qualified<ModelName>,
        model_data_connector_object_type: DataConnectorObjectType,
        filter_expression_type: Qualified<CustomTypeName>,
        filter_expression_data_connector_object_type: DataConnectorObjectType,
    },

    #[error(
        "The relationship '{relationship_name}' cannot be used as a comparable relationship in boolean expression type '{boolean_expression_type_name}' because it is a remote relationship with an argument mapping target. Relationship '{relationship_name}' on type '{source_type}' has source field '{source_field}' mapped to target argument '{target_argument}'"
    )]
    RemoteComparableRelationshipWithArgumentMappingTargetNotSupported {
        boolean_expression_type_name: Qualified<CustomTypeName>,
        relationship_name: open_dds::relationships::RelationshipName,
        source_type: Qualified<CustomTypeName>,
        source_field: FieldName,
        target_argument: open_dds::query::ArgumentName,
    },

    #[error("{0}")]
    GraphqlConfigError(#[from] graphql_config::GraphqlConfigError),

    #[error("{0}")]
    ScalarBooleanExpressionTypeError(
        #[from] scalar_boolean_expressions::ScalarBooleanExpressionTypeError,
    ),

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Remove the argument-mapped remote relationship from the boolean expression type's comparable/filterable relationships
  2. Change the remote relationship mapping so source fields map to target fields rather than target arguments, if the remote API allows it
  3. Perform the filtering on the remote side via a command/permission rule instead of the boolean expression type

Example fix

// before: relationship maps source field to target argument
relationships:
  authors:
    mapping:
      - sourceField: author_id
        targetArgument: id
// after: map to a target field
relationships:
  authors:
    mapping:
      - sourceField: author_id
        targetField: id
Defensive patterns

Strategy: validation

Validate before calling

for (const rel of boolExpRelationships(boolExpType)) {
  const r = relationshipByName(rel);
  if (r.kind === 'remote' && r.mapping.some(m => m.targetArgument)) {
    fail(`remote relationship ${rel} maps to a target argument; not usable in filters`);
  }
}

Prevention

When it happens

Trigger: Including a remote relationship in a boolean expression type (to filter across it) where the relationship's mapping maps a source field to an argument on the target rather than to a target field comparison.

Common situations: Trying to filter a model by a field of a remote relationship (e.g. remote join to another subgraph) when that relationship passes a source field as an argument to the remote query; typical in federation/remote-relationship setups.

Related errors


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