{"record":{"id":"a7f4aa8c665ca303","repo":"dgraph-io/dgraph","slug":"argument-s-in-s-s-is-missing-it-is-require","errorCode":null,"errorMessage":"argument `%s` in %s `%s` is missing, it is required by remote %s.","messagePattern":"argument `(.+?)` in (.+?) `(.+?)` is missing, it is required by remote (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/schema/remote.go","lineNumber":520,"sourceCode":"\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,\n\t\t\t\t*md.operationType, *md.givenQryName)\n\n\t\t}\n\t}\n\n\t// check all non-null args required by remote query/mutation are present in given query/mutation\n\tfor _, remoteArgName := range md.remoteArgMd.requiredArgs {\n\t\t_, ok := md.givenArgVals[remoteArgName]\n\t\tif !ok {\n\t\t\treturn errors.Errorf(\"argument `%s` in %s `%s` is missing, it is required by remote\"+\n\t\t\t\t\" %s.\", remoteArgName, *md.operationType, *md.givenQryName, *md.operationType)\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype expandTypeParams struct {\n\t// expandedTypes tells whether a type has already been expanded or not.\n\t// If a key with typename is present in this map, it means that type has been expanded.\n\texpandedTypes map[string]struct{}\n\t// remoteTypes is the mapping of typename -> typeDefinition for all the types present in\n\t// introspection response for remote query.\n\tremoteTypes map[string]*types\n\t// typesToFields is the mapping of typename -> fieldDefinitions for the types present in\n\t// introspection response for remote query.\n\ttypesToFields map[string][]*gqlField\n}","sourceCodeStart":502,"sourceCodeEnd":538,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/schema/remote.go#L502-L538","documentation":"After checking the supplied arguments, matchArgSignature iterates the remote operation's required (non-null, no default) arguments and verifies each one is present in the given query/mutation. If a required remote argument is not supplied at all, this error is thrown. It ensures composed queries remain executable on the remote, which would otherwise reject them for missing required arguments.","triggerScenarios":"validateRemoteGraphql -> matchArgSignature when the local/composed query omits an argument the remote field declares as non-null without a default (listed in remoteArgMd.requiredArgs), e.g. remote `user(id: ID!)` but query calls `user` with no `id`.","commonSituations":"Remote added a new required argument in an upgrade, breaking previously valid queries; optional-looking local schema hid a required remote arg; argument supplied conditionally; stale local schema not re-synced after upstream change.","solutions":["Add the missing argument to the query, ideally as a variable: `query($id: ID!) { user(id: $id) }`.","Introspect the remote field to list all non-null arguments (and their types) and supply each one.","If the remote recently added the requirement, update the stored remote SDL and all dependent queries, or pin the upstream version.","If the remote should not require it, request the upstream team make the argument nullable or give it a default value."],"exampleFix":"// before (remote: user(id: ID!))\nquery { user }\n// after\nquery($id: ID!) { user(id: $id) }","handlingStrategy":"validation","validationCode":"// Verify all remote required args are supplied before composing\nfor _, req := range remoteRequiredArgs {\n    if _, ok := givenArgs[req]; !ok {\n        return fmt.Errorf(\"missing required arg %s for remote %s\", req, opName)\n    }\n}","typeGuard":"func hasRequiredArgs(given map[string]*ast.Argument, required []string) bool {\n    for _, r := range required {\n        if _, ok := given[r]; !ok { return false }\n    }\n    return true\n}","tryCatchPattern":"if err := validateRemoteGraphql(...); err != nil {\n    if strings.Contains(err.Error(), \"is missing, it is required by remote\") {\n        return fmt.Errorf(\"add required argument: %w\", err)\n    }\n    return err\n}","preventionTips":["Introspect remote non-null arguments and generate query templates that always supply them","Re-validate all stored queries after upstream schema upgrades","Pin upstream versions; treat new required args as breaking changes","Run this validator in CI before deploying composed schemas"],"tags":["graphql","required-argument","remote-schema"],"backgroundTag":"missing-required-argument","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}