hasura/graphql-engine · error · Error
no such field on type {type_name}: {field_name}
Error message
no such field on type {type_name}: {field_name} What it means
Thrown when a selection references a field that does not exist on the parent type, e.g. `user { emial }` or querying a field defined on a different type. Raised from SelectableType field lookup in validation/collect.rs:43 and :50 during field collection. The error includes the type name and the unknown field name for quick localization.
Source
Thrown at v3/crates/graphql/lang-graphql/src/validation/error.rs:34
#[error("{} is defined on a non-composite type: {type_name}", match fragment_name { None => "inline fragment".to_owned(), Some(fragment_name) => format!("fragment {fragment_name}")})]
FragmentOnNonCompositeType {
fragment_name: Option<ast::Name>,
type_name: ast::TypeName,
},
#[error("fragment of type {fragment_type} cannot be spread on type {selection_type}")]
FragmentCannotBeSpread {
selection_type: ast::TypeName,
fragment_type: ast::TypeName,
},
// TODO, this error isn't thrown yet
#[error(
"a selection set is specified on field '{field_name}' of non-composite type: {type_name}"
)]
SelectionOnNonCompositeType {
field_name: ast::Name,
type_name: ast::TypeName,
},
#[error("no such field on type {type_name}: {field_name}")]
NoFieldOnType {
type_name: ast::TypeName,
field_name: ast::Name,
},
#[error("no such type defined in the document: {0}")]
UnknownType(ast::TypeName),
#[error("an internal error occurred during validation: type lookup failed for {type_name}")]
InternalTypeNotFound { type_name: ast::TypeName },
#[error(
"an internal error occurred during validation: field {field_name} lookup failed for sub type '{sub_type_name}' of type '{type_name}'"
)]
InternalNoFieldOnSubtype {
type_name: ast::TypeName,
sub_type_name: ast::TypeName,
field_name: ast::Name,
},
#[error(
"different fields {field1} and {field2} cannot be merged under the same alias: {alias}"View on GitHub (pinned to 724551b9ae)
Solutions
- Check the field name for typos against the schema
- Confirm the field exists on the exact parent type being selected (and on the concrete type, not a sibling type)
- Regenerate/refresh the client against the current schema, or pin queries to a schema version
Example fix
// before
{ user { emial } }
// after
{ user { email } } Defensive patterns
Strategy: validation
Validate before calling
let fields: HashSet<&str> = schema.fields(parent_type).collect(); for f in selected_fields(doc, parent_type) { assert!(fields.contains(f), "unknown field {f} on {parent_type}"); } Type guard
fn field_exists(schema: &Schema, ty: &str, field: &str) -> bool { schema.fields(ty).any(|f| f == field) } Try / catch
match validate(doc) { Err(Error::NoFieldOnType { type_name, field_name }) => suggest_closest_field(schema, type_name, field_name), r => r } Prevention
- Validate queries against the schema at build/test time
- Use codegen types so field names are type-checked
- Run graphql-lint / CI validation on persisted queries
When it happens
Trigger: Selecting a field not defined on the parent object/interface in the schema; typos in field names; querying fields that only exist on a different type or on an older/newer schema version; missing an interface fragment's type condition so the field lookup runs against the wrong parent type.
Common situations: Client and server schema drift after a deploy removes/renames fields; multiple schema versions in different environments (staging vs prod); hand-written queries without IDE validation; codegen against a stale schema.
Related errors
- validation failed: {0}
- Unexpected value: expecting {expected_kind:}, but found: {fo
- '{name:}' is not a valid GraphQL name.
- '{alias:} is not a valid alias
- {value} is not a valid limit value
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/95797447eb2a78d2.
Report an issue: GitHub.