{"record":{"id":"9d872e79a1a96306","repo":"dgraph-io/dgraph","slug":"unable-to-find-local-type-s-in-the-remote-schema","errorCode":null,"errorMessage":"Unable to find local type %s in the remote schema","messagePattern":"Unable to find local type (.+?) in the remote schema","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/schema/remote.go","lineNumber":369,"sourceCode":"func matchDeepTypes(remoteType *gqlType, remoteTypes map[string]*types,\n\tlocalSchema *ast.Schema) error {\n\t_, err := expandType(remoteType, remoteTypes)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn matchRemoteTypes(localSchema, remoteTypes)\n}\n\nfunc matchRemoteTypes(schema *ast.Schema, remoteTypes map[string]*types) error {\n\tfor typeName, def := range schema.Types {\n\t\torigTyp := schema.Types[typeName]\n\t\tremoteDir := origTyp.Directives.ForName(remoteDirective)\n\t\tif remoteDir != nil {\n\t\t\t{\n\t\t\t\tremoteType, ok := remoteTypes[def.Name]\n\t\t\t\tfields := def.Fields\n\t\t\t\tif !ok {\n\t\t\t\t\treturn errors.Errorf(\n\t\t\t\t\t\t\"Unable to find local type %s in the remote schema\",\n\t\t\t\t\t\ttypeName,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tremoteFields := remoteType.Fields\n\t\t\t\tif remoteFields == nil {\n\t\t\t\t\t// Get fields for INPUT_OBJECT\n\t\t\t\t\tremoteFields = remoteType.InputFields\n\t\t\t\t}\n\t\t\t\tfor _, field := range fields {\n\t\t\t\t\tvar remoteField *gqlField = nil\n\t\t\t\t\tfor _, rf := range remoteFields {\n\t\t\t\t\t\tif rf.Name == field.Name {\n\t\t\t\t\t\t\tremoteField = rf\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif remoteField == nil {\n\t\t\t\t\t\treturn errors.Errorf(","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/schema/remote.go#L351-L387","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\ntype Account @remote { id: ID! }\n// after — remote calls it UserAccount\ntype UserAccount @remote { id: ID! }","handlingStrategy":"validation","validationCode":"for (const local of localTypesWithRemoteDirective) {\n  if (!remoteHasType(introspection, local.name)) throw new Error(`local type ${local.name} not found in remote schema`)\n}","typeGuard":"function localTypeExistsRemotely(introspection, typeName) { return introspection?.__schema?.types?.some(t => t.name === typeName) ?? false }","tryCatchPattern":null,"preventionTips":["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"],"tags":["graphql","remote-schema","type-resolution","deep-type-match"],"backgroundTag":"type-not-in-remote-schema","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}