dgraph-io/dgraph · error

argument `%s` in %s `%s` of List kind has non-object element

Error message

argument `%s` in %s `%s` of List kind has non-object elements in remote %s, Lists can have only INPUT_OBJECT as element.

What it means

When a list argument is accepted (remote arg is a LIST), matchArgSignature additionally requires that the remote list's element type is an INPUT_OBJECT. If the remote element type is a scalar, enum, or other kind, this error is thrown. The library's argument matcher only supports lists of input objects for deep element validation.

Source

Thrown at graphql/schema/remote.go:485

				schema:        md.schema,
			}); err != nil {
				return err
			}
		case ast.ListValue:
			if !((remoteArgTyp.Kind == list && remoteArgTyp.OfType != nil) || (remoteArgTyp.
				Kind == nonNull && remoteArgTyp.OfType != nil && remoteArgTyp.OfType.
				Kind == list && remoteArgTyp.OfType.OfType != nil)) {
				return errors.Errorf("LIST value supplied for argument `%s` in %s `%s`, "+
					"but remote argument doesn't accept LIST.", givenArgName, *md.operationType,
					*md.givenQryName)
			}
			remoteListElemTypname := remoteArgTyp.NamedType()
			remoteObjTyp, ok := md.remoteTypes[remoteListElemTypname]
			if !ok {
				return missingRemoteTypeError(remoteListElemTypname)
			}
			if remoteObjTyp.Kind != inputObject {
				return errors.Errorf("argument `%s` in %s `%s` of List kind has non-object"+
					" elements in remote %s, Lists can have only INPUT_OBJECT as element.",
					givenArgName, *md.operationType, *md.givenQryName, *md.operationType)
			}
			remoteObjChildMap := getRemoteTypeFieldsMetadata(remoteObjTyp)
			for _, givenElem := range givenArgVal.Children {
				if givenElem.Value.Kind != ast.ObjectValue {
					return errors.Errorf("argument `%s` in %s `%s` of List kind has non-object"+
						" elements, Lists can have only objects as element.", givenArgName,
						*md.operationType, *md.givenQryName)
				}
				if err := matchArgSignature(&argMatchingMetadata{
					givenArgVals:  getObjChildrenValsAsMap(givenElem.Value),
					givenVarTypes: md.givenVarTypes,
					remoteArgMd:   remoteObjChildMap,
					remoteTypes:   md.remoteTypes,
					givenQryName:  md.givenQryName,
					operationType: md.operationType,
					schema:        md.schema,

View on GitHub (pinned to 759e242be6)

Solutions

  1. Supply scalar/enum elements matching the remote list element type (e.g. `ids: ["1","2"]`) if the remote is a scalar list.
  2. If object elements are intended, change the remote schema so the list element is an INPUT_OBJECT type.
  3. If the remote legitimately uses scalar lists and this validator is too strict, bypass/skip argument deep-matching for that field via configuration if available, or file/patch the validator.
  4. Confirm the correct remote operation is being composed; wrong target can surface element-kind mismatches.

Example fix

// before (remote arg: ids: [ID!])
query { users(ids: [{id: "1"}]) }
// after
query { users(ids: ["1"]) }
Defensive patterns

Strategy: validation

Validate before calling

// For list args, verify the element type is INPUT_OBJECT
elem := listElementType(remoteArgType)
if elem == nil || elem.Kind != "INPUT_OBJECT" {
    return fmt.Errorf("remote list element for %s is not INPUT_OBJECT", argName)
}

Type guard

func isInputObjectList(t *ast.Type) bool {
    elem := t.NamedType()
    return elem != "" && remoteTypes[elem] != nil && remoteTypes[elem].Kind == inputObject
}

Try / catch

if err := validateRemoteGraphql(...); err != nil {
    if strings.Contains(err.Error(), "non-object elements in remote") {
        return fmt.Errorf("use scalar elements or fix remote SDL: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: validateRemoteGraphql -> matchArgSignature on a query supplying a list value (e.g. `f(items: [{a: 1}])`) where the remote argument is `[Int]`, `[String]`, or an enum list — i.e. the element kind is not INPUT_OBJECT.

Common situations: Remote changed a list of input objects into a list of scalars/IDs; client models the argument as object elements while remote expects primitive elements; composition library limitation hit for scalar lists.

Related errors


AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01). Data as JSON: /api/errors/372deec2cd963986. Report an issue: GitHub.