hasura/graphql-engine · error · ScalarBooleanExpressionOperatorIssue

the operator '{operator_name}' in the boolean expression '{t

Error message

the operator '{operator_name}' in the boolean expression '{type_name}' is only applicable on string scalars: {reason}

What it means

A string-only operator (like like/ilike) was applied to a boolean expression type whose scalar or argument types are not strings; the reason variant details which check failed.

Source

Thrown at v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/error.rs:163

    },
    #[error(
        "the argument type '{argument_type}' for the operator '{operator_name}' in the boolean expression '{type_name}' should match the scalar type '{scalar_type}'"
    )]
    ArgumentTypeShouldMatchScalar {
        type_name: Qualified<CustomTypeName>,
        operator_name: OperatorName,
        argument_type: QualifiedTypeReference,
        scalar_type: QualifiedTypeName,
    },
    #[error(
        "the argument type for the operator '{operator_name}' in the boolean expression '{type_name}' is not compatible with the mapped operator's argument type defined in the data connector: {issue}"
    )]
    ArgumentTypeMismatch {
        type_name: Qualified<CustomTypeName>,
        operator_name: OperatorName,
        issue: type_validation::TypeCompatibilityIssue,
    },
    #[error(
        "the operator '{operator_name}' in the boolean expression '{type_name}' is only applicable on string scalars: {reason}"
    )]
    OnlyApplicableOnStringScalar {
        type_name: Qualified<CustomTypeName>,
        operator_name: OperatorName,
        reason: StringOperatorReason,
    },
}

impl ShouldBeAnError for ScalarBooleanExpressionOperatorIssue {
    fn should_be_an_error(&self, flags: &flags::OpenDdFlags) -> bool {
        flags.contains(flags::Flag::ValidateScalarBooleanExpressionOperators)
    }
}

#[derive(Debug, thiserror::Error)]
pub enum StringOperatorReason {
    #[error("scalar type '{scalar_type}' is not a string")]

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Remove string-only operators from non-string scalar boolean expression types
  2. Fix the argument type so it is a non-list string matching the scalar (per the nested reason)

Example fix

// before
# boolean expression on scalar Numeric
operators:
  - name: like
// after
# boolean expression on scalar Numeric
operators:
  - name: less_than
Defensive patterns

Strategy: validation

Validate before calling

fn is_stringy(t: &QualifiedTypeName) -> bool { matches!(t, QualifiedTypeName::BuiltIn(BuiltInType::String)) }
if operator.is_string_only() && !(is_stringy(scalar) && is_stringy(&arg)) {
    return Err("string operator on non-string type");
}

Prevention

When it happens

Trigger: Defining string operators on non-string scalar types, using non-string argument types for string operators, or wrapping string operator arguments in lists.

Common situations: Copying a full operator set (including like/ilike) onto numeric, uuid, or date scalar types.

Related errors


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