{"record":{"id":"0259ce953aab5806","repo":"hasura/graphql-engine","slug":"unknown-field-field-name-used-in-predicate-fo","errorCode":null,"errorMessage":"unknown field '{field_name:}' used in predicate for type '{type_name:}'","messagePattern":"unknown field '(.+?)' used in predicate for type '(.+?)'","errorType":"validation","errorClass":"TypePredicateError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/types/error.rs","lineNumber":387,"sourceCode":"    pub lines_of: Vec<T>,\n}\n\nimpl<T: Display> Display for SeparatedBy<T> {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        for (index, elem) in self.lines_of.iter().enumerate() {\n            elem.fmt(f)?;\n            if index < self.lines_of.len() - 1 {\n                writeln!(f)?;\n            }\n        }\n\n        Ok(())\n    }\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum TypePredicateError {\n    #[error(\"unknown field '{field_name:}' used in predicate for type '{type_name:}'\")]\n    UnknownFieldInTypePredicate {\n        field_name: Spanned<FieldName>,\n        type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\n        \"field '{field_name:}' used in predicate for type '{type_name:}' could not be found in boolean expression {boolean_expression_type}\"\n    )]\n    TypePredicateFieldNotFoundInBooleanExpression {\n        field_name: Spanned<FieldName>,\n        type_name: Qualified<CustomTypeName>,\n        boolean_expression_type: Qualified<CustomTypeName>,\n    },\n\n    #[error(\"field '{field_name:}' could not be found in field mappings for type '{type_name:}'\")]\n    UnknownFieldInFieldMappings {\n        field_name: Spanned<FieldName>,\n        type_name: Qualified<CustomTypeName>,\n    },","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/types/error.rs#L369-L405","documentation":"Thrown during metadata resolution when a type predicate (filterExpression) references a field that does not exist on the type being filtered. The resolver looks up every field name in the predicate against the resolved type's field set and rejects unknown names with the offending field and type.","triggerScenarios":"Defining a `filterExpressionType` / type predicate JSON that uses a field name not present on the object type it filters; renaming or deleting a model field without updating the predicate; typo in a field name inside a predicate expression.","commonSituations":"Renaming a column/field in the underlying model but leaving stale predicates in metadata; hand-written predicate JSON with typos; copy-pasting a predicate between types whose fields differ.","solutions":["Check the exact `field_name` and `type_name` in the message and open that type's field definitions","Fix the typo or rename the field in the predicate to a field that exists on `type_name`","If the field was removed intentionally, delete the predicate expression that references it","If the field lives on a related model, use a relationship-based predicate instead of a direct field reference"],"exampleFix":"// before: predicate references 'userNam' which does not exist\n{\"field\": \"userNam\", \"operator\": \"_eq\", \"value\": \"bob\"}\n// after\n{\"field\": \"userName\", \"operator\": \"_eq\", \"value\": \"bob\"}\n","handlingStrategy":"validation","validationCode":"// Before resolving, verify every predicate field exists on the type\nlet valid: HashSet<&str> = object_type\n    .fields\n    .keys()\n    .map(|f| f.as_str())\n    .collect();\nfor f in predicate.field_paths() {\n    if !valid.contains(f) {\n        return Err(format!(\"unknown field {f} on {}\", object_type.name));\n    }\n}\nOk(())","typeGuard":"fn is_known_field(ty: &ObjectType, name: &str) -> bool {\n    ty.fields.keys().any(|f| f.as_str() == name)\n}","tryCatchPattern":"// On resolution failure, surface field/type to the user\nif let Err(metadata_resolve::Error::TypePredicate(TypePredicateError::UnknownFieldInTypePredicate { field_name, type_name })) = result {\n    return Err(format!(\"filter field {field_name} not on {type_name}\"));\n}","preventionTips":["Generate predicates from the type's field list rather than hand-writing them","Add a metadata lint step that cross-checks predicate fields against type fields"],"tags":["metadata","predicate","filter","type-safety","hasura"],"backgroundTag":"unknown-field-in-filter","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}