dgraph-io/dgraph · error

argument `%s` in %s `%s` is missing, it is required by remot

Error message

argument `%s` in %s `%s` is missing, it is required by remote %s.

What it means

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.

Source

Thrown at graphql/schema/remote.go:520

					operationType: md.operationType,
					schema:        md.schema,
				}); err != nil {
					return err
				}
			}
		default:
			return errors.Errorf("scalar value supplied for argument `%s` in %s `%s`, "+
				"only Variable, Object, or List values are allowed.", givenArgName,
				*md.operationType, *md.givenQryName)

		}
	}

	// check all non-null args required by remote query/mutation are present in given query/mutation
	for _, remoteArgName := range md.remoteArgMd.requiredArgs {
		_, ok := md.givenArgVals[remoteArgName]
		if !ok {
			return errors.Errorf("argument `%s` in %s `%s` is missing, it is required by remote"+
				" %s.", remoteArgName, *md.operationType, *md.givenQryName, *md.operationType)
		}
	}

	return nil
}

type expandTypeParams struct {
	// expandedTypes tells whether a type has already been expanded or not.
	// If a key with typename is present in this map, it means that type has been expanded.
	expandedTypes map[string]struct{}
	// remoteTypes is the mapping of typename -> typeDefinition for all the types present in
	// introspection response for remote query.
	remoteTypes map[string]*types
	// typesToFields is the mapping of typename -> fieldDefinitions for the types present in
	// introspection response for remote query.
	typesToFields map[string][]*gqlField
}

View on GitHub (pinned to 759e242be6)

Solutions

  1. Add the missing argument to the query, ideally as a variable: `query($id: ID!) { user(id: $id) }`.
  2. Introspect the remote field to list all non-null arguments (and their types) and supply each one.
  3. If the remote recently added the requirement, update the stored remote SDL and all dependent queries, or pin the upstream version.
  4. If the remote should not require it, request the upstream team make the argument nullable or give it a default value.

Example fix

// before (remote: user(id: ID!))
query { user }
// after
query($id: ID!) { user(id: $id) }
Defensive patterns

Strategy: validation

Validate before calling

// Verify all remote required args are supplied before composing
for _, req := range remoteRequiredArgs {
    if _, ok := givenArgs[req]; !ok {
        return fmt.Errorf("missing required arg %s for remote %s", req, opName)
    }
}

Type guard

func hasRequiredArgs(given map[string]*ast.Argument, required []string) bool {
    for _, r := range required {
        if _, ok := given[r]; !ok { return false }
    }
    return true
}

Try / catch

if err := validateRemoteGraphql(...); err != nil {
    if strings.Contains(err.Error(), "is missing, it is required by remote") {
        return fmt.Errorf("add required argument: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: 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`.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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