{"record":{"id":"95797447eb2a78d2","repo":"hasura/graphql-engine","slug":"no-such-field-on-type-type-name-field-name","errorCode":null,"errorMessage":"no such field on type {type_name}: {field_name}","messagePattern":"no such field on type (.+?): (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/lang-graphql/src/validation/error.rs","lineNumber":34,"sourceCode":"    #[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}\")})]\n    FragmentOnNonCompositeType {\n        fragment_name: Option<ast::Name>,\n        type_name: ast::TypeName,\n    },\n    #[error(\"fragment of type {fragment_type} cannot be spread on type {selection_type}\")]\n    FragmentCannotBeSpread {\n        selection_type: ast::TypeName,\n        fragment_type: ast::TypeName,\n    },\n    // TODO, this error isn't thrown yet\n    #[error(\n        \"a selection set is specified on field '{field_name}' of non-composite type: {type_name}\"\n    )]\n    SelectionOnNonCompositeType {\n        field_name: ast::Name,\n        type_name: ast::TypeName,\n    },\n    #[error(\"no such field on type {type_name}: {field_name}\")]\n    NoFieldOnType {\n        type_name: ast::TypeName,\n        field_name: ast::Name,\n    },\n    #[error(\"no such type defined in the document: {0}\")]\n    UnknownType(ast::TypeName),\n    #[error(\"an internal error occurred during validation: type lookup failed for {type_name}\")]\n    InternalTypeNotFound { type_name: ast::TypeName },\n    #[error(\n        \"an internal error occurred during validation: field {field_name} lookup failed for sub type '{sub_type_name}' of type '{type_name}'\"\n    )]\n    InternalNoFieldOnSubtype {\n        type_name: ast::TypeName,\n        sub_type_name: ast::TypeName,\n        field_name: ast::Name,\n    },\n    #[error(\n        \"different fields {field1} and {field2} cannot be merged under the same alias: {alias}\"","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/lang-graphql/src/validation/error.rs#L16-L52","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n{ user { emial } }\n// after\n{ user { email } }","handlingStrategy":"validation","validationCode":"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}\"); }","typeGuard":"fn field_exists(schema: &Schema, ty: &str, field: &str) -> bool { schema.fields(ty).any(|f| f == field) }","tryCatchPattern":"match validate(doc) { Err(Error::NoFieldOnType { type_name, field_name }) => suggest_closest_field(schema, type_name, field_name), r => r }","preventionTips":["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"],"tags":["graphql","unknown-field","schema","validation"],"backgroundTag":"graphql-field-not-on-type","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}