dgraph-io/dgraph · error

remote %s `%s` accepts %d arguments, It must have only one a

Error message

remote %s `%s` accepts %d arguments, It must have only one argument of the form `[{param1: $var1, param2: $var2, ...}]` for BATCH mode.

What it means

In BATCH mode, the remote query/mutation must accept exactly one argument, which must be a list of an input object (optionally non-null wrapped). If the remote operation has any other number of arguments, this error reports how many arguments it accepts and the required form `[{param1: $var1, ...}]`.

Source

Thrown at graphql/schema/remote.go:299

	}
	if expectedReturnType != gotReturnType {
		return errors.Errorf("found return type mismatch for %s `%s`, expected `%s`, got `%s`.",
			operationType, givenQuery.Name, expectedReturnType, gotReturnType)
	}
	// Deep check the remote return type.
	if err := matchDeepTypes(introspectedRemoteQuery.Type, remoteTypes,
		metadata.schema); err != nil {
		return err
	}

	givenQryArgVals := getGivenQueryArgValsAsMap(givenQuery)
	givenQryVarTypes := getVarTypesAsMap(metadata.parentField, metadata.parentType)
	remoteQryArgMetadata := getRemoteQueryArgMetadata(introspectedRemoteQuery)

	// verify remote query arg format for BATCH mode
	if metadata.isBatch {
		if len(remoteQryArgMetadata.typMap) != 1 {
			return errors.Errorf("remote %s `%s` accepts %d arguments, It must have only one "+
				"argument of the form `[{param1: $var1, param2: $var2, ...}]` for BATCH mode.",
				operationType, givenQuery.Name, len(remoteQryArgMetadata.typMap))
		}
		for argName, inputTyp := range remoteQryArgMetadata.typMap {
			if !((inputTyp.Kind == list && inputTyp.OfType != nil && inputTyp.OfType.
				Kind == inputObject) ||
				(inputTyp.Kind == list && inputTyp.OfType != nil && inputTyp.OfType.
					Kind == nonNull && inputTyp.OfType.OfType != nil && inputTyp.OfType.OfType.
					Kind == inputObject) ||
				(inputTyp.Kind == nonNull && inputTyp.OfType != nil && inputTyp.OfType.
					Kind == list && inputTyp.OfType.OfType != nil && inputTyp.OfType.OfType.
					Kind == inputObject) ||
				(inputTyp.Kind == nonNull && inputTyp.OfType != nil && inputTyp.OfType.
					Kind == list && inputTyp.OfType.OfType != nil && inputTyp.OfType.OfType.
					Kind == nonNull && inputTyp.OfType.OfType.OfType != nil && inputTyp.
					OfType.OfType.OfType.Kind == inputObject)) {
				return errors.Errorf("argument `%s` for given %s `%s` must be of the form `[{param1"+
					": $var1, param2: $var2, ...}]` for BATCH mode in remote %s.", argName,

View on GitHub (pinned to 759e242be6)

Solutions

  1. Refactor the remote query/mutation to accept a single argument that is a list of an input object, e.g. `users(input: [UserInput!]!): [User]`.
  2. Switch the custom directive to SINGLE mode if the remote operation takes individual arguments.
  3. Point BATCH mode at a different remote operation that already matches the required signature.

Example fix

// before (remote)
type Query { user(id: ID!): User }
// after (remote accepts a single list-of-input-object argument)
type Query { users(inputs: [UserInput!]!): [User] }
Defensive patterns

Strategy: validation

Validate before calling

if (isBatch) {
  const args = remoteOp.args || []
  if (args.length !== 1) throw new Error(`BATCH remote op ${remoteOp.name} must have exactly 1 argument, has ${args.length}`)
}

Type guard

function isBatchCompatible(remoteOp) { return (remoteOp.args || []).length === 1 }

Prevention

When it happens

Trigger: metadata.isBatch is true and len(remoteQryArgMetadata.typMap) != 1 — the introspected remote operation declares zero, two, or more arguments (graphql/schema/remote.go:299).

Common situations: Using BATCH mode against a remote operation designed for single entities (one scalar argument, or multiple args); remote API uses a non-list argument for bulk operations; config switched mode to BATCH without updating the remote API contract.

Related errors


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