dgraph-io/dgraph · error
Unable to find local type %s in the remote schema
Error message
Unable to find local type %s in the remote schema
What it means
matchRemoteTypes runs for local types carrying the remote directive marker. For each such local type definition, it looks the type up by name in the introspected remote types; if the local type's name is not present in the remote schema, this error is returned.
Source
Thrown at graphql/schema/remote.go:369
func matchDeepTypes(remoteType *gqlType, remoteTypes map[string]*types,
localSchema *ast.Schema) error {
_, err := expandType(remoteType, remoteTypes)
if err != nil {
return err
}
return matchRemoteTypes(localSchema, remoteTypes)
}
func matchRemoteTypes(schema *ast.Schema, remoteTypes map[string]*types) error {
for typeName, def := range schema.Types {
origTyp := schema.Types[typeName]
remoteDir := origTyp.Directives.ForName(remoteDirective)
if remoteDir != nil {
{
remoteType, ok := remoteTypes[def.Name]
fields := def.Fields
if !ok {
return errors.Errorf(
"Unable to find local type %s in the remote schema",
typeName,
)
}
remoteFields := remoteType.Fields
if remoteFields == nil {
// Get fields for INPUT_OBJECT
remoteFields = remoteType.InputFields
}
for _, field := range fields {
var remoteField *gqlField = nil
for _, rf := range remoteFields {
if rf.Name == field.Name {
remoteField = rf
}
}
if remoteField == nil {
return errors.Errorf(View on GitHub (pinned to 759e242be6)
Solutions
- Rename the local type to match the remote schema's type name, or add the type to the remote schema.
- Remove the @remote annotation from types that are not meant to be resolved remotely.
- Re-introspect the remote schema and regenerate local types to keep names in sync.
Example fix
// before
type Account @remote { id: ID! }
// after — remote calls it UserAccount
type UserAccount @remote { id: ID! } Defensive patterns
Strategy: validation
Validate before calling
for (const local of localTypesWithRemoteDirective) {
if (!remoteHasType(introspection, local.name)) throw new Error(`local type ${local.name} not found in remote schema`)
} Type guard
function localTypeExistsRemotely(introspection, typeName) { return introspection?.__schema?.types?.some(t => t.name === typeName) ?? false } Prevention
- Keep local remote-resolved type names identical to remote type names
- Only annotate types as remote-resolved when they exist in the remote schema
- Regenerate local types from remote introspection to avoid drift
When it happens
Trigger: matchDeepTypes walks the remote return type and finds a local type annotated with @remote (remoteDir != nil); the lookup remoteTypes[def.Name] fails, so "Unable to find local type %s in the remote schema" is returned (graphql/schema/remote.go:369).
Common situations: Local schema defines a custom-named type for remote resolution but the remote schema uses a different type name; remote renamed/removed the type; local type was added without a corresponding remote type.
Related errors
- POST method cannot have query parameters in url: %s
- while json unmarshaling result from remote introspection que
- remote schema doesn't have any queries.
- remote schema doesn't have any mutations.
- %s `%s` is not present in remote schema.
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/9d872e79a1a96306.
Report an issue: GitHub.