{"record":{"id":"19d5ece08f616946","repo":"hasura/graphql-engine","slug":"validation-failed-0","errorCode":null,"errorMessage":"validation failed: {0}","messagePattern":"validation failed: (.+?)","errorType":"validation","errorClass":"RequestError::ValidationFailed","httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/frontend/src/error.rs","lineNumber":14,"sourceCode":"use axum::response::IntoResponse;\nuse engine_types::ExposeInternalErrors;\nuse gql::http::GraphQLError;\nuse lang_graphql as gql;\nuse tracing_util::{ErrorVisibility, TraceableError};\n\n/// Request errors are raised before execution of root fields begins.\n/// Ref: <https://spec.graphql.org/October2021/#sec-Errors.Request-errors>\n#[derive(Debug, thiserror::Error)]\npub enum RequestError {\n    #[error(\"parsing failed: {0}\")]\n    ParseFailure(#[from] gql::ast::spanning::Positioned<gql::parser::Error>),\n\n    #[error(\"validation failed: {0}\")]\n    ValidationFailed(#[from] gql::validation::Error),\n\n    #[error(\"{0}\")]\n    IRConversionError(#[from] graphql_ir::Error),\n\n    #[error(\"{0}\")]\n    GraphQlPlanError(#[from] graphql_ir::GraphqlIrPlanError),\n\n    #[error(\"explain error: {0}\")]\n    ExplainError(String),\n}\n\nimpl RequestError {\n    pub fn to_graphql_error(&self, expose_internal_errors: ExposeInternalErrors) -> GraphQLError {\n        let message = match (self, expose_internal_errors) {\n            // Error messages for internal errors from IR conversion and Plan generations are masked.\n            (\n                Self::IRConversionError(graphql_ir::Error::Internal(_)),","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/frontend/src/error.rs#L1-L32","documentation":"RequestError::ValidationFailed is returned when the parsed GraphQL document fails semantic validation against the schema. It wraps gql::validation::Error, so the message is 'validation failed: {0}' with the specific rule violation (unknown field, wrong argument type, etc.). Like other RequestErrors it is raised before execution of root fields begins.","triggerScenarios":"A syntactically valid GraphQL document that references undefined fields/arguments, passes arguments of the wrong type, uses unknown directives, subscribes to non-subscription fields, or violates any validation rule in the October 2021 spec section on validation.","commonSituations":"Schema drift: client was built against an older schema where a field existed; typos in field names; missing variables or wrong variable types; introspection-based codegen out of date after a schema change.","solutions":["Compare the query against the current schema via GraphiQL autocomplete or an introspection query and fix the flagged field/argument","Regenerate client code (graphql-codegen, Apollo CLI) against the updated schema","Check the wrapped validation error message and location for the exact rule that failed","If a field was removed/renamed server-side, update the query or restore the field in metadata"],"exampleFix":"// before\nquery { usr(id: 1) { nm } }\n\n// after\nquery { user(id: 1) { name } }","handlingStrategy":"validation","validationCode":"// Client-side pre-validation against the schema:\nimport { buildSchema, validate, parse } from 'graphql';\nconst schema = buildSchema(await fetchIntrospection());\nconst errors = validate(schema, parse(query));\nif (errors.length) throw new Error(errors.map(e => e.message).join('; '));","typeGuard":null,"tryCatchPattern":"match frontend.execute(&req).await {\n    Err(e @ RequestError::ValidationFailed(v)) => {\n        // v has message + locations; return GraphQL-style errors with 400\n        respond_validation_error(v)\n    }\n    rest => rest,\n}","preventionTips":["Validate documents against the live schema during development (GraphiQL)","Regenerate client types whenever the schema changes","Track schema-breaking changes in CI so validation drift is caught pre-release"],"tags":["rust","graphql","validation","schema-mismatch","request-error"],"backgroundTag":"graphql-validation-error","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}