{"record":{"id":"4314aa3d6cc99c2b","repo":"hasura/graphql-engine","slug":"type-mismatch-error","errorCode":null,"errorMessage":"type mismatch: {error:}","messagePattern":"type mismatch: (.+?)","errorType":"validation","errorClass":"TypeError::TypeCheckError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/types/error.rs","lineNumber":715,"sourceCode":"                        path: field_name.path.clone(),\n                        subgraph: field_type.get_subgraph().cloned(),\n                    }\n                ))\n            }\n\n            TypePredicateError::ScalarBooleanExpressionTypeError(error) => error.create_error_context(),\n            _ => None\n        }\n    }\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum TypeError {\n    #[error(\"expected to find a custom named type in {qualified_type_reference:} but none found\")]\n    NoNamedTypeFound {\n        qualified_type_reference: QualifiedTypeReference,\n    },\n    #[error(\"type mismatch: {error:}\")]\n    TypeCheckError { error: TypecheckError },\n}\n\nimpl From<AggregateExpressionError> for Error {\n    fn from(val: AggregateExpressionError) -> Self {\n        Error::AggregateExpressionError(val)\n    }\n}\n\nimpl From<TypecheckError> for Error {\n    fn from(type_error: TypecheckError) -> Self {\n        Error::TypeError {\n            type_error: TypeError::TypeCheckError { error: type_error },\n        }\n    }\n}\n","sourceCodeStart":697,"sourceCodeEnd":732,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/types/error.rs#L697-L732","documentation":"A TypeError wrapper indicating that a value expression failed type checking: the expression's inferred type did not match the type expected by its context (argument, field, comparison, etc.). The underlying TypecheckError carries specifics of the mismatch (e.g. string vs uuid).","triggerScenarios":"Any metadata resolution path that runs the typechecker on expressions, e.g. argument presets, command arguments, or filter expressions where the expression type (literal, variable, session variable) does not unify with the declared target type (TypeCheckError { error: TypecheckError }).","commonSituations":"Passing a string literal or session variable where a uuid/date/comparison type is declared; boolean expressions used where a scalar is expected; mismatches after changing a field's type without updating presets.","solutions":["Read the inner TypecheckError message for expected vs actual types","Fix the expression (literal, preset, or variable) so its type matches the declared argument/field type","If a session variable is involved, remember it is a string; cast or compare accordingly"],"exampleFix":"// before\npreset: \"2023-01-01\" // declared as date comparison\n// after\npreset: { eq: \"2023-01-01\" } // matches the comparison type","handlingStrategy":"validation","validationCode":"// Validate expression types against the declared argument type before submission\nassert_expression_type_matches(&expr, &declared_type)?;","typeGuard":null,"tryCatchPattern":"match result {\n    Err(Error::TypeError(TypeError::TypeCheckError { error })) => {\n        eprintln!(\"type mismatch: {error}\");\n    }\n    _ => {}\n}","preventionTips":["Keep argument types and presets in one review when changing schemas","Add unit tests covering each preset expression"],"tags":["typecheck","expression","metadata","hasura"],"backgroundTag":"type-mismatch","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}