dgraph-io/dgraph · error

object value supplied for argument `%s` in %s `%s`, but remo

Error message

object value supplied for argument `%s` in %s `%s`, but remote argument doesn't accept INPUT_OBJECT.

What it means

When an argument is supplied as a GraphQL object literal (ast.ObjectValue), matchArgSignature checks that the remote argument's type is an INPUT_OBJECT (possibly wrapped in NonNull). If the remote argument is a scalar, list, or enum instead, this error is thrown. The library only forwards structured object arguments to remotes that declare a matching input object type.

Source

Thrown at graphql/schema/remote.go:451

			//if rootType.NamedType == "ID" {
			//	rootType.NamedType = "String"
			//}
			expectedArgType := givenArgTyp.String()
			gotArgType := remoteArgTyp.String()
			if expectedArgType != gotArgType {
				return errors.Errorf("found type mismatch for variable `$%s` in %s `%s`, expected"+
					" `%s`, got `%s`.", givenArgVal.Raw, *md.operationType, *md.givenQryName,
					expectedArgType, gotArgType)
			}
			// deep check the remote type and verify it with the local schema.
			if err := matchDeepTypes(remoteArgTyp, md.remoteTypes, md.schema); err != nil {
				return err
			}
		case ast.ObjectValue:
			if !(remoteArgTyp.Kind == inputObject || (remoteArgTyp.
				Kind == nonNull && remoteArgTyp.OfType != nil && remoteArgTyp.OfType.
				Kind == inputObject)) {
				return errors.Errorf("object value supplied for argument `%s` in %s `%s`, "+
					"but remote argument doesn't accept INPUT_OBJECT.", givenArgName,
					*md.operationType, *md.givenQryName)
			}
			remoteObjTypname := remoteArgTyp.NamedType()
			remoteObjTyp, ok := md.remoteTypes[remoteObjTypname]
			if !ok {
				return missingRemoteTypeError(remoteObjTypname)
			}
			if err := matchArgSignature(&argMatchingMetadata{
				givenArgVals:  getObjChildrenValsAsMap(givenArgVal),
				givenVarTypes: md.givenVarTypes,
				remoteArgMd:   getRemoteTypeFieldsMetadata(remoteObjTyp),
				remoteTypes:   md.remoteTypes,
				givenQryName:  md.givenQryName,
				operationType: md.operationType,
				schema:        md.schema,
			}); err != nil {
				return err

View on GitHub (pinned to 759e242be6)

Solutions

  1. Change the query to supply a value whose shape matches the remote argument's declared kind (scalar literal, enum, or list).
  2. Update the remote schema/SDL so the argument is (re)declared as an INPUT_OBJECT if object input is intended.
  3. Verify you are pointing at the intended remote field/service — the kind mismatch often means the wrong operation is being composed.
  4. Refresh any cached/introspected remote schema after upstream changes.

Example fix

// before (remote arg: filter: String)
query { search(filter: {q: "x"}) }
// after
query { search(filter: "x") }
Defensive patterns

Strategy: validation

Validate before calling

// Ensure object literals are only used for INPUT_OBJECT args
if valueKind == "ObjectValue" && !(argType.Kind == "INPUT_OBJECT" || wraps(argType, "INPUT_OBJECT")) {
    return fmt.Errorf("arg %s is not INPUT_OBJECT on remote", argName)
}

Type guard

func isInputObject(t *ast.Type) bool {
    return t.Kind == inputObject || (t.Kind == nonNull && t.OfType != nil && t.OfType.Kind == inputObject)
}

Try / catch

if err := validateRemoteGraphql(...); err != nil {
    if strings.Contains(err.Error(), "doesn't accept INPUT_OBJECT") {
        return fmt.Errorf("reshape argument %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: validateRemoteGraphql -> matchArgSignature on a query like `query { f(filter: {a: 1}) }` where the remote argument `filter` is declared as a scalar/enum/list rather than an INPUT_OBJECT type (or NonNull-wrapped INPUT_OBJECT).

Common situations: Local schema treats a field as an object while the remote defines it as scalar (e.g. remote changed an input from an object to a scalar JSON/enum); wrong remote field targeted; stale remote SDL cached locally.

Related errors


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