{"record":{"id":"f4df5ecc20e2163c","repo":"dgraph-io/dgraph","slug":"argument-s-in-s-s-of-list-kind-has-non-obje-f4df5e","errorCode":null,"errorMessage":"argument `%s` in %s `%s` of List kind has non-object elements, Lists can have only objects as element.","messagePattern":"argument `(.+?)` in (.+?) `(.+?)` of List kind has non-object elements, Lists can have only objects as element\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/schema/remote.go","lineNumber":492,"sourceCode":"\t\t\t\tKind == list && remoteArgTyp.OfType.OfType != nil)) {\n\t\t\t\treturn errors.Errorf(\"LIST value supplied for argument `%s` in %s `%s`, \"+\n\t\t\t\t\t\"but remote argument doesn't accept LIST.\", givenArgName, *md.operationType,\n\t\t\t\t\t*md.givenQryName)\n\t\t\t}\n\t\t\tremoteListElemTypname := remoteArgTyp.NamedType()\n\t\t\tremoteObjTyp, ok := md.remoteTypes[remoteListElemTypname]\n\t\t\tif !ok {\n\t\t\t\treturn missingRemoteTypeError(remoteListElemTypname)\n\t\t\t}\n\t\t\tif remoteObjTyp.Kind != inputObject {\n\t\t\t\treturn errors.Errorf(\"argument `%s` in %s `%s` of List kind has non-object\"+\n\t\t\t\t\t\" elements in remote %s, Lists can have only INPUT_OBJECT as element.\",\n\t\t\t\t\tgivenArgName, *md.operationType, *md.givenQryName, *md.operationType)\n\t\t\t}\n\t\t\tremoteObjChildMap := getRemoteTypeFieldsMetadata(remoteObjTyp)\n\t\t\tfor _, givenElem := range givenArgVal.Children {\n\t\t\t\tif givenElem.Value.Kind != ast.ObjectValue {\n\t\t\t\t\treturn errors.Errorf(\"argument `%s` in %s `%s` of List kind has non-object\"+\n\t\t\t\t\t\t\" elements, Lists can have only objects as element.\", givenArgName,\n\t\t\t\t\t\t*md.operationType, *md.givenQryName)\n\t\t\t\t}\n\t\t\t\tif err := matchArgSignature(&argMatchingMetadata{\n\t\t\t\t\tgivenArgVals:  getObjChildrenValsAsMap(givenElem.Value),\n\t\t\t\t\tgivenVarTypes: md.givenVarTypes,\n\t\t\t\t\tremoteArgMd:   remoteObjChildMap,\n\t\t\t\t\tremoteTypes:   md.remoteTypes,\n\t\t\t\t\tgivenQryName:  md.givenQryName,\n\t\t\t\t\toperationType: md.operationType,\n\t\t\t\t\tschema:        md.schema,\n\t\t\t\t}); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn errors.Errorf(\"scalar value supplied for argument `%s` in %s `%s`, \"+\n\t\t\t\t\"only Variable, Object, or List values are allowed.\", givenArgName,","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/schema/remote.go#L474-L510","documentation":"Inside a valid list-of-INPUT_OBJECT argument, each supplied element must itself be an object literal. matchArgSignature recurses into each element via matchArgSignature to validate its fields; if any element value is a scalar, variable, or list rather than an ast.ObjectValue, this error is thrown. It enforces that every list element conforms to the remote input object shape.","triggerScenarios":"validateRemoteGraphql -> matchArgSignature recursion on `f(items: [\"a\", {b: 1}])` — the first element is a scalar, so the per-element ObjectValue check fails before recursion; also hit with nested lists `[ [..] ]`.","commonSituations":"Mixed element types in a list literal; a variable used as a list element where objects were expected; code-generated queries that inject scalars into an object list; hand-edited queries with a dropped object brace.","solutions":["Make every element of the list an object literal matching the remote INPUT_OBJECT fields (e.g. `[{id: \"1\"}, {id: \"2\"}]`).","If scalar elements are correct, the remote list element type is a scalar — fix the remote SDL or use the scalar list form (see related non-object-elements-in-remote error).","If a variable is needed per element, declare it as the input object type: `$item: ItemInput!` inside the list is generally unsupported here — inline the object instead.","Validate query literals with a GraphQL parser/linter before running remote composition."],"exampleFix":"// before\nquery { createUsers(users: [\"alice\", {name: \"bob\"}]) }\n// after\nquery { createUsers(users: [{name: \"alice\"}, {name: \"bob\"}]) }","handlingStrategy":"validation","validationCode":"// Verify every list element is an object literal\nfor i, el := range listValue.Children {\n    if el.Value.Kind != \"ObjectValue\" {\n        return fmt.Errorf(\"element %d of arg %s is not an object\", i, argName)\n    }\n}","typeGuard":"func allElementsAreObjects(v *ast.Value) bool {\n    for _, c := range v.Children {\n        if c.Value.Kind != ast.ObjectValue { return false }\n    }\n    return true\n}","tryCatchPattern":"if err := validateRemoteGraphql(...); err != nil {\n    if strings.Contains(err.Error(), \"non-object elements, Lists can have only objects\") {\n        return fmt.Errorf(\"malformed list literal: %w\", err)\n    }\n    return err\n}","preventionTips":["Build list literals programmatically to guarantee uniform object elements","Validate queries with a GraphQL parser before composition","Avoid mixing scalars and objects in list literals"],"tags":["graphql","list","object-value"],"backgroundTag":"graphql-argument-kind-mismatch","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}