hasura/graphql-engine · error · StringOperatorReason
argument type '{argument_type}' is not a string
Error message
argument type '{argument_type}' is not a string What it means
Nested reason for OnlyApplicableOnStringScalar: the operator's argument type is not a string type.
Source
Thrown at v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/error.rs:183
)]
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")]
ScalarTypeNotString { scalar_type: QualifiedTypeName },
#[error("argument type '{argument_type}' is not a string")]
ArgumentTypeNotString { argument_type: QualifiedTypeName },
#[error("argument type '{argument_type}' is a list")]
ArgumentTypeShouldNotBeList {
argument_type: QualifiedTypeReference,
},
}
#[derive(Debug, Eq, PartialEq, Copy, Clone, derive_more::with_trait::Display)]
#[allow(clippy::enum_variant_names)] // It's fine that they all end with "Operator" :/
pub enum FieldNameSource {
#[display("comparable operator")]
ComparisonOperator,
#[display("logical operator")]
LogicalOperator,
#[display("is null operator")]
IsNullOperator,
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Change the operator's argument type to the string scalar the boolean expression is defined on
Example fix
// before
argument_type: {scalar: Numeric}
// after
argument_type: {scalar: String} Defensive patterns
Strategy: type-guard
Type guard
fn argument_is_string(t: &QualifiedTypeName) -> bool {
matches!(t, QualifiedTypeName::BuiltIn(open_dds::types::BuiltInType::String))
} Prevention
- Keep string operator arguments typed as the same string scalar
When it happens
Trigger: A string operator's argument uses a non-string QualifiedTypeName (e.g. numeric or uuid).
Common situations: Mismatched argument type when hand-authoring string operators.
Related errors
- the operator '{operator_name}' in the boolean expression '{t
- scalar type '{scalar_type}' is not a string
- argument type '{argument_type}' is a list
- the operand type '{operand_type}' does not match the operand
- type mismatch between the aggregation function '{aggregation
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/dabfd750266d127b.
Report an issue: GitHub.