{"record":{"id":"6b22d6250f887a8d","repo":"hasura/graphql-engine","slug":"value-did-not-match-array-type-was-expecting-exp","errorCode":null,"errorMessage":"Value did not match array type, was expecting {expected_type}","messagePattern":"Value did not match array type, was expecting (.+?)","errorType":"validation","errorClass":"MapFieldNamesError","httpStatus":null,"severity":"error","filePath":"v3/crates/plan/src/query/arguments.rs","lineNumber":645,"sourceCode":"                    plan_expression(&predicate, relationships, remote_predicates, plan_state)?;\n\n                Argument::BooleanExpression {\n                    predicate: resolved_filter_expression,\n                }\n            }\n            UnresolvedArgument::Literal { value } => Argument::Literal {\n                value: value.clone(),\n            },\n        };\n        resolved_arguments.insert(argument_name, resolved_argument_value.clone());\n    }\n\n    Ok(resolved_arguments)\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum MapFieldNamesError {\n    #[error(\"Value did not match array type, was expecting {expected_type}\")]\n    ExpectedAnArray {\n        expected_type: QualifiedTypeReference,\n    },\n    #[error(\"Value did not match object type, was expecting {expected_type}\")]\n    ExpectedAnObject {\n        expected_type: QualifiedTypeReference,\n    },\n    #[error(\"Type mappings not found for object type {object_type_name}\")]\n    TypeMappingsNotFound {\n        object_type_name: Qualified<CustomTypeName>,\n    },\n    #[error(\"Field mapping {field_name} not found for object type {object_type_name}\")]\n    FieldMappingNotFound {\n        object_type_name: Qualified<CustomTypeName>,\n        field_name: FieldName,\n    },\n    #[error(\"Unknown fields found in object type {object_type_name}: {fields:?}\")]\n    UnknownFieldsInObject {","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/plan/src/query/arguments.rs#L627-L663","documentation":"Thrown by MapFieldNamesError::ExpectedAnArray when mapping user-supplied argument values against the schema's array types during query planning. The planner encountered a value position the schema types as a list/array, but the runtime value (or its inferred type) does not match the expected element/list type. It almost always indicates a mismatch between the client-provided arguments and the NDC schema type mappings.","triggerScenarios":"Calling a query/mutation with a list-typed argument where the value provided is a scalar/object instead of a JSON array, or whose elements don't match the array's declared element type, while map_field_names is resolving argument field names in v3/crates/plan/src/query/arguments.rs.","commonSituations":"Sending a single object where the API expects an array of objects; nested arrays with wrong inner types; stale client code after the schema changed a scalar argument into a list; inconsistent nullability of elements.","solutions":["Check the failing argument in the request and wrap the value in a JSON array if the schema declares a list type","Verify element types and nullability of the array against the schema (e.g. [String!] vs [String])","Regenerate/refresh the client from the current schema if the argument type recently changed","Inspect the NDC type mappings for the object to ensure the array type mapping is present and correct"],"exampleFix":"// before\nvariables: { \"tags\": \"production\" }\n// after\nvariables: { \"tags\": [\"production\"] }","handlingStrategy":"validation","validationCode":"// Before sending, check list-typed arguments against the schema\nfn assert_list_arg(name: &str, v: &serde_json::Value) -> Result<(), String> {\n    v.as_array().map(|_| ()).ok_or_else(|| format!(\"argument '{name}' must be an array\"))\n}","typeGuard":"const isJSONArray = (v: unknown): v is unknown[] => Array.isArray(v);","tryCatchPattern":"match plan { Err(e @ PlanError::MapFieldNames(MapFieldNamesError::ExpectedAnArray { expected_type })) => /* 400 with expected_type back to client */, ... }","preventionTips":["Generate variable types from the schema and typecheck requests client-side","Validate variables with a strict schema validator before executing the query","Keep client models in sync via codegen on schema changes"],"tags":["rust","graphql","query-planning","arguments","type-mismatch"],"backgroundTag":"argument-type-mismatch","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}