dgraph-io/dgraph · error
Schema state not found for %s.
Error message
Schema state not found for %s.
What it means
After confirming the attribute is indexed, pickTokenizer calls schema.State().Tokenizer to fetch the tokenizer list; if it comes back nil despite the attribute being indexed, this error is thrown. It indicates the in-memory schema state lacks tokenizer metadata for a predicate that IsIndexed claims is indexed.
Source
Thrown at worker/tokens.go:86
if funcType == ngramFn {
if query {
return tok.GetNGramQueryTokens(funcArgs, lang)
} else {
return tok.GetNGramTokens(funcArgs, lang)
}
}
return tok.GetTermTokens(funcArgs)
}
func pickTokenizer(ctx context.Context, attr string, f string) (tok.Tokenizer, error) {
// Get the tokenizers and choose the corresponding one.
if !schema.State().IsIndexed(ctx, attr) {
return nil, errors.Errorf("Attribute %s is not indexed.", attr)
}
tokenizers := schema.State().Tokenizer(ctx, attr)
if tokenizers == nil {
return nil, errors.Errorf("Schema state not found for %s.", attr)
}
for _, t := range tokenizers {
// If function is eq and we found a tokenizer that's !Lossy(), lets return it
switch f {
case "eq":
// For equality, find a non-lossy tokenizer.
if !t.IsLossy() {
return t, nil
}
default:
// rest of the cases: ge, gt, le, lt require a sortable tokenizer.
if t.IsSortable() {
return t, nil
}
}
}
// Should we return an error if we don't find a non-lossy tokenizer for eq function.View on GitHub (pinned to 759e242be6)
Solutions
- Retry the query after the schema mutation settles; if it persists, restart/rebalance so nodes reload a consistent schema.
- Re-apply the schema alteration (drop and re-add the index) so tokenizer metadata is rebuilt.
- Check cluster schema consistency (all nodes report the same schema) and fix stale nodes.
Example fix
// before: predicate altered while queries in flight // after: re-apply schema and retry await dgraph.Alter(ctx, "name: string @index(exact) .") // then run the eq query
Defensive patterns
Strategy: retry
Try / catch
err := runQuery(ctx)
if err != nil && strings.Contains(err.Error(), "Schema state not found") {
time.Sleep(backoff)
err = runQuery(ctx) // retry after schema state settles
} Prevention
- Avoid running queries concurrently with schema alterations where possible.
- Ensure all cluster nodes have converged on the same schema after mutations.
- Re-apply index alterations if tokenizer metadata appears lost.
When it happens
Trigger: An indexed predicate whose schema entry has no tokenizer entry — typically a race or inconsistency between schema state and the tokenizer registry, e.g. querying during/just after a schema mutation, or a predicate indexed in one way that lost its tokenizer metadata.
Common situations: Concurrent schema alterations while queries run; cluster where a node has stale/partial schema state; predicates with index types that do not map to string tokenizers (note: for non-string indexed predicates hitting compare functions, the not-indexed or no-proper-index errors are more typical).
Related errors
- illegal rune found "%c", expecting {
- Malformed JSON
- Require type of tokenizer for pred: %s of type: %s for index
- Tokenizers present without indexing on attr %s
- Invalid tokenizer %s
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/dc3d0273b80b6c32.
Report an issue: GitHub.