dgraph-io/dgraph · error

unimplemented query type %s

Error message

unimplemented query type %s

What it means

Rewrite in the GraphQL query rewriter converts a parsed GraphQL operation into DQL queries. Each query must have a known QueryType (query, aggregate query, entities query, etc.); the default branch means Dgraph encountered a query type it has no rewriter for — usually a new/unknown type or a bug where an operation was classified incorrectly. This is an internal capability limitation surfaced to the caller.

Source

Thrown at graphql/resolve/query_rewriter.go:160

	case schema.SimilarByIdQuery:
		xid, uid, err := gqlQuery.IDArgValue()
		if err != nil {
			return nil, nil, err
		}
		return rewriteAsSimilarByIdQuery(gqlQuery, uid, xid, authRw), nil, nil
	case schema.SimilarByEmbeddingQuery:
		return rewriteAsSimilarByEmbeddingQuery(gqlQuery, authRw), nil, nil
	case schema.FilterQuery:
		return rewriteAsQuery(gqlQuery, authRw), nil, nil
	case schema.PasswordQuery:
		return passwordQuery(gqlQuery, authRw)
	case schema.AggregateQuery:
		return aggregateQuery(gqlQuery, authRw), nil, nil
	case schema.EntitiesQuery:
		queries, err := entitiesQuery(gqlQuery, authRw)
		return queries, nil, err
	default:
		return nil, nil, errors.Errorf("unimplemented query type %s", gqlQuery.QueryType())
	}
}

// entitiesQuery rewrites the Apollo `_entities` Query which is sent from the Apollo gateway to a DQL query.
// This query is sent to the Dgraph service to resolve types `extended` and defined by this service.
func entitiesQuery(field schema.Query, authRw *authRewriter) ([]*dql.GraphQuery, error) {

	// Input Argument to the Query is a List of "__typename" and "keyField" pair.
	// For this type Extension:-
	// 	extend type Product @key(fields: "upc") {
	// 		upc: String @external
	// 		reviews: [Review]
	// 	}
	// Input to the Query will be
	// "_representations": [
	// 		{
	// 		  "__typename": "Product",
	// 	 	 "upc": "B00005N5PF"

View on GitHub (pinned to 759e242be6)

Solutions

  1. Upgrade Dgraph to a version that supports the query type being used
  2. Check the operation being sent and remove/replace unsupported query constructs
  3. Verify the schema only declares query fields Dgraph supports (no foreign/unknown query types)
Defensive patterns

Strategy: fallback

Try / catch

resp, err := resolver.Resolve(ctx, req)
if err != nil && strings.Contains(err.Error(), "unimplemented query type") {
  log.Printf("unsupported query type sent: %+v", req.Query)
  // return a clear client error or fall back to a supported endpoint
}

Prevention

When it happens

Trigger: Calling Resolve on a GraphQL request whose operation contains a query whose schema.QueryType() is not one of the handled cases — e.g. a subscription-style or unsupported query kind reaching the rewrite path, or a version mismatch where the schema declares a query type the resolver doesn't implement.

Common situations: Running a Dgraph version older than the schema/feature in use (e.g. _entities federation queries added later); custom tooling generating queries Dgraph misclassifies; sending GraphQL operations over endpoints meant only for queries/mutations.

Related errors


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