{"record":{"id":"2bd22bea342de58d","repo":"dgraph-io/dgraph","slug":"remote-s-s-accepts-d-arguments-it-must-have","errorCode":null,"errorMessage":"remote %s `%s` accepts %d arguments, It must have only one argument of the form `[{param1: $var1, param2: $var2, ...}]` for BATCH mode.","messagePattern":"remote (.+?) `(.+?)` accepts (.+?) arguments, It must have only one argument of the form `\\[(.+?)\\]` for BATCH mode\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/schema/remote.go","lineNumber":299,"sourceCode":"\t}\n\tif expectedReturnType != gotReturnType {\n\t\treturn errors.Errorf(\"found return type mismatch for %s `%s`, expected `%s`, got `%s`.\",\n\t\t\toperationType, givenQuery.Name, expectedReturnType, gotReturnType)\n\t}\n\t// Deep check the remote return type.\n\tif err := matchDeepTypes(introspectedRemoteQuery.Type, remoteTypes,\n\t\tmetadata.schema); err != nil {\n\t\treturn err\n\t}\n\n\tgivenQryArgVals := getGivenQueryArgValsAsMap(givenQuery)\n\tgivenQryVarTypes := getVarTypesAsMap(metadata.parentField, metadata.parentType)\n\tremoteQryArgMetadata := getRemoteQueryArgMetadata(introspectedRemoteQuery)\n\n\t// verify remote query arg format for BATCH mode\n\tif metadata.isBatch {\n\t\tif len(remoteQryArgMetadata.typMap) != 1 {\n\t\t\treturn errors.Errorf(\"remote %s `%s` accepts %d arguments, It must have only one \"+\n\t\t\t\t\"argument of the form `[{param1: $var1, param2: $var2, ...}]` for BATCH mode.\",\n\t\t\t\toperationType, givenQuery.Name, len(remoteQryArgMetadata.typMap))\n\t\t}\n\t\tfor argName, inputTyp := range remoteQryArgMetadata.typMap {\n\t\t\tif !((inputTyp.Kind == list && inputTyp.OfType != nil && inputTyp.OfType.\n\t\t\t\tKind == inputObject) ||\n\t\t\t\t(inputTyp.Kind == list && inputTyp.OfType != nil && inputTyp.OfType.\n\t\t\t\t\tKind == nonNull && inputTyp.OfType.OfType != nil && inputTyp.OfType.OfType.\n\t\t\t\t\tKind == inputObject) ||\n\t\t\t\t(inputTyp.Kind == nonNull && inputTyp.OfType != nil && inputTyp.OfType.\n\t\t\t\t\tKind == list && inputTyp.OfType.OfType != nil && inputTyp.OfType.OfType.\n\t\t\t\t\tKind == inputObject) ||\n\t\t\t\t(inputTyp.Kind == nonNull && inputTyp.OfType != nil && inputTyp.OfType.\n\t\t\t\t\tKind == list && inputTyp.OfType.OfType != nil && inputTyp.OfType.OfType.\n\t\t\t\t\tKind == nonNull && inputTyp.OfType.OfType.OfType != nil && inputTyp.\n\t\t\t\t\tOfType.OfType.OfType.Kind == inputObject)) {\n\t\t\t\treturn errors.Errorf(\"argument `%s` for given %s `%s` must be of the form `[{param1\"+\n\t\t\t\t\t\": $var1, param2: $var2, ...}]` for BATCH mode in remote %s.\", argName,","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/schema/remote.go#L281-L317","documentation":"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, ...}]`.","triggerScenarios":"metadata.isBatch is true and len(remoteQryArgMetadata.typMap) != 1 — the introspected remote operation declares zero, two, or more arguments (graphql/schema/remote.go:299).","commonSituations":"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.","solutions":["Refactor the remote query/mutation to accept a single argument that is a list of an input object, e.g. `users(input: [UserInput!]!): [User]`.","Switch the custom directive to SINGLE mode if the remote operation takes individual arguments.","Point BATCH mode at a different remote operation that already matches the required signature."],"exampleFix":"// before (remote)\ntype Query { user(id: ID!): User }\n// after (remote accepts a single list-of-input-object argument)\ntype Query { users(inputs: [UserInput!]!): [User] }","handlingStrategy":"validation","validationCode":"if (isBatch) {\n  const args = remoteOp.args || []\n  if (args.length !== 1) throw new Error(`BATCH remote op ${remoteOp.name} must have exactly 1 argument, has ${args.length}`)\n}","typeGuard":"function isBatchCompatible(remoteOp) { return (remoteOp.args || []).length === 1 }","tryCatchPattern":null,"preventionTips":["Design remote bulk endpoints as single-argument list-of-input-object operations","Check remote op arity before enabling BATCH mode in config","Fall back to SINGLE mode when remote ops take individual arguments"],"tags":["graphql","batch","arguments","remote-schema"],"backgroundTag":"batch-argument-signature-mismatch","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}