{"record":{"id":"c8929c869be4671a","repo":"dgraph-io/dgraph","slug":"s-s-is-not-present-in-remote-schema","errorCode":null,"errorMessage":"%s `%s` is not present in remote schema.","messagePattern":"(.+?) `(.+?)` is not present in remote schema\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graphql/schema/remote.go","lineNumber":272,"sourceCode":"\t\tremoteTypes[typ.Name] = typ\n\t}\n\n\tremoteQryType, ok := remoteTypes[remoteQueryTypename]\n\tif !ok {\n\t\treturn missingRemoteTypeError(remoteQueryTypename)\n\t}\n\n\t// check whether given query/mutation is present in remote schema\n\tvar introspectedRemoteQuery *gqlField\n\tgivenQuery := metadata.graphqlOpDef.SelectionSet[0].(*ast.Field)\n\tfor _, remoteQuery := range remoteQryType.Fields {\n\t\tif remoteQuery.Name == givenQuery.Name {\n\t\t\tintrospectedRemoteQuery = remoteQuery\n\t\t\tbreak\n\t\t}\n\t}\n\tif introspectedRemoteQuery == nil {\n\t\treturn errors.Errorf(\"%s `%s` is not present in remote schema.\",\n\t\t\toperationType, givenQuery.Name)\n\t}\n\n\t// check whether the return type of remote query is same as the required return type\n\texpectedReturnType := metadata.parentField.Type.String()\n\tgotReturnType := introspectedRemoteQuery.Type.String()\n\tif metadata.isBatch {\n\t\texpectedReturnType = fmt.Sprintf(\"[%s]\", expectedReturnType)\n\t}\n\tif expectedReturnType != gotReturnType {\n\t\treturn errors.Errorf(\"found return type mismatch for %s `%s`, expected `%s`, got `%s`.\",\n\t\t\toperationType, givenQuery.Name, expectedReturnType, gotReturnType)\n\t}\n\t// Deep check the remote return type.\n\tif err := matchDeepTypes(introspectedRemoteQuery.Type, remoteTypes,\n\t\tmetadata.schema); err != nil {\n\t\treturn err\n\t}","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/graphql/schema/remote.go#L254-L290","documentation":"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.","triggerScenarios":"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`.","commonSituations":"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.","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)."],"exampleFix":"// before\nmutation { createUser(name: $name): User @custom(directive: {name: \"custom\", arguments: [{name: \"http\", value: {url: \"https://api.example.com/graphql\"}}], mode: SINGLE, operation: mutation}) }\n// after\nmutation { userCreate(name: $name): User @custom(directive: {name: \"custom\", arguments: [{name: \"http\", value: {url: \"https://api.example.com/graphql\"}}], mode: SINGLE, operation: mutation}) }","handlingStrategy":"validation","validationCode":"const remoteOp = introspection.__schema[`${opType}Type`]?.fields.find(f => f.name === fieldName)\nif (!remoteOp) throw new Error(`${opType} ${fieldName} not found on remote; expected one of: ${fields.map(f=>f.name)}`)","typeGuard":"function remoteHasOp(introspection, opType, name) { return !!introspection?.__schema?.[`${opType}Type`]?.fields?.some(f => f.name === name) }","tryCatchPattern":null,"preventionTips":["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"],"tags":["graphql","remote-schema","missing-field","custom-directive"],"backgroundTag":"field-not-in-remote-schema","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}