dgraph-io/dgraph · error
%s `%s` is not present in remote schema.
Error message
%s `%s` is not present in remote schema.
What it means
After introspecting the remote schema, the library looks for the query/mutation with the exact name given in the custom directive among the remote root type's fields. If no field with that name exists on the remote QueryType/MutationType, this error reports that the operation is not present in the remote schema.
Source
Thrown at graphql/schema/remote.go:272
remoteTypes[typ.Name] = typ
}
remoteQryType, ok := remoteTypes[remoteQueryTypename]
if !ok {
return missingRemoteTypeError(remoteQueryTypename)
}
// check whether given query/mutation is present in remote schema
var introspectedRemoteQuery *gqlField
givenQuery := metadata.graphqlOpDef.SelectionSet[0].(*ast.Field)
for _, remoteQuery := range remoteQryType.Fields {
if remoteQuery.Name == givenQuery.Name {
introspectedRemoteQuery = remoteQuery
break
}
}
if introspectedRemoteQuery == nil {
return errors.Errorf("%s `%s` is not present in remote schema.",
operationType, givenQuery.Name)
}
// check whether the return type of remote query is same as the required return type
expectedReturnType := metadata.parentField.Type.String()
gotReturnType := introspectedRemoteQuery.Type.String()
if metadata.isBatch {
expectedReturnType = fmt.Sprintf("[%s]", expectedReturnType)
}
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
}View on GitHub (pinned to 759e242be6)
Solutions
- Check the remote introspection/SDL and correct the field name in the custom directive to match an existing remote query/mutation.
- If the remote removed the operation, remove or replace the local field using it.
- Confirm you introspected the right endpoint (correct env/version of the remote service).
Example fix
// before
mutation { createUser(name: $name): User @custom(directive: {name: "custom", arguments: [{name: "http", value: {url: "https://api.example.com/graphql"}}], mode: SINGLE, operation: mutation}) }
// after
mutation { userCreate(name: $name): User @custom(directive: {name: "custom", arguments: [{name: "http", value: {url: "https://api.example.com/graphql"}}], mode: SINGLE, operation: mutation}) } Defensive patterns
Strategy: validation
Validate before calling
const remoteOp = introspection.__schema[`${opType}Type`]?.fields.find(f => f.name === fieldName)
if (!remoteOp) throw new Error(`${opType} ${fieldName} not found on remote; expected one of: ${fields.map(f=>f.name)}`) Type guard
function remoteHasOp(introspection, opType, name) { return !!introspection?.__schema?.[`${opType}Type`]?.fields?.some(f => f.name === name) } Prevention
- Generate custom directive configs from fresh remote introspection, not hand-typed names
- Fail fast in CI when remote operations referenced by config disappear
- Watch remote API changelogs for renames/removals
When it happens
Trigger: validateRemoteGraphql iterates the remote root type's fields looking for remoteQuery.Name == givenQuery.Name; no match is found (graphql/schema/remote.go:272). E.g. custom directive references mutation `createUser` but remote schema only exposes `userCreate`.
Common situations: Remote API renamed or removed the operation; naming convention mismatch (camelCase vs snake_case); pointing at the wrong remote service version; local config written against docs of a different API.
Related errors
- remote schema doesn't have any queries.
- remote schema doesn't have any mutations.
- %s field for the local type %s is not present in the remote
- POST method cannot have query parameters in url: %s
- while json unmarshaling result from remote introspection que
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/c8929c869be4671a.
Report an issue: GitHub.