hasura/graphql-engine · error · TypecheckIssue
Typecheck failed for field {field_name:} in object type {obj
Error message
Typecheck failed for field {field_name:} in object type {object_type:}: {error:} What it means
A TypecheckIssue that wraps a nested TypecheckError for one specific field of an object type, adding context: the field name, the object type it belongs to, and the underlying error. It lets you pinpoint which key inside an object literal failed typechecking.
Source
Thrown at v3/crates/metadata-resolve/src/helpers/typecheck.rs:36
},
#[error("Error in array item: {inner_error:}")]
ArrayItemMismatch { inner_error: Box<TypecheckError> },
#[error("Expected an array but instead got value {value:}")]
NonArrayValue { value: serde_json::Value },
#[error("Expected a non-null value but received null")]
NullInNonNullableColumn,
}
#[derive(Error, Debug, PartialEq)]
/// Issues that can occur when typechecking a value against an object type
pub enum TypecheckIssue {
#[error("Expected an object value of type {expected:} but got value {actual:}")]
ObjectTypeMismatch {
expected: Qualified<CustomTypeName>,
actual: serde_json::Value,
},
#[error("Typecheck failed for field {field_name:} in object type {object_type:}: {error:}")]
ObjectTypeField {
field_name: FieldName,
object_type: Qualified<CustomTypeName>,
error: TypecheckError,
},
#[error(
"Found a literal value but the argument is a boolean expression type '{boolean_expression_type_name}'"
)]
LiteralValueUsedForBooleanExpression {
boolean_expression_type_name: Qualified<CustomTypeName>,
},
}
impl ShouldBeAnError for TypecheckIssue {
fn should_be_an_error(&self, flags: &open_dds::flags::OpenDdFlags) -> bool {
match self {
TypecheckIssue::ObjectTypeField { .. } | TypecheckIssue::ObjectTypeMismatch { .. } => {View on GitHub (pinned to 724551b9ae)
Solutions
- Inspect the nested {error:} and fix the named {field_name:} in the literal
- Align the field's value with the field's declared type in the object type definition
- Re-run to check the remaining fields
Example fix
// before default: age: "thirty" # age: Int! // after default: age: 30
Defensive patterns
Strategy: try-catch
Try / catch
// Field-level context is already attached; log field_name + object_type with the inner error:
if let TypecheckIssue::ObjectTypeField { field_name, object_type, error } = issue {
eprintln!("{object_type:?}.{field_name}: {error}");
} Prevention
- Validate nested field values per-field in tests
- Keep defaults in sync with object type field definitions
- Use schema-driven form generation for object literals
When it happens
Trigger: Typechecking an object-typed value where one field's value violates its declared type, e.g. {age: "old"} for an Int field, or a null in a non-null field.
Common situations: Wrong field value types in nested defaults, renamed or retyped object fields leaving stale metadata values, nulls in non-nullable subfields.
Related errors
- Expected an object value of type {expected:} but got value {
- failed to get version from server: %w
- Expected a value of type {expected:} but got value {actual:}
- Error in array item: {inner_error:}
- Expected an array but instead got value {value:}
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/5521d9f340899a5a.
Report an issue: GitHub.