{"record":{"id":"6784f3f977df454a","repo":"dgraph-io/dgraph","slug":"failed-to-enrich-schema","errorCode":null,"errorMessage":"failed to enrich schema","messagePattern":"failed to enrich schema","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"schema/parse.go","lineNumber":672,"sourceCode":"\t\t\tresult.Types = append(result.Types, typeUpdate)\n\t\t\treturn nil\n\t\t}\n\n\t\tschema, err := parseScalarPair(it, item.Val, ns)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tresult.Preds = append(result.Preds, schema)\n\t\treturn nil\n\t}\n\n\tit := l.NewIterator()\n\tfor it.Next() {\n\t\titem := it.Item()\n\t\tswitch item.Typ {\n\t\tcase lex.ItemEOF:\n\t\t\tif err := resolveTokenizers(result.Preds); err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"failed to enrich schema\")\n\t\t\t}\n\t\t\treturn &result, nil\n\n\t\tcase itemText:\n\t\t\t// For schema which does not contain the namespace information, use the default\n\t\t\t// namespace, if namespace has to be preserved. Else, use the passed namespace.\n\t\t\tns := x.RootNamespace\n\t\t\tif namespace != math.MaxUint64 {\n\t\t\t\tns = namespace\n\t\t\t}\n\t\t\tif err := parseTypeOrSchema(item, it, ns); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\tcase itemLeftSquare:\n\t\t\t// We expect a namespace.\n\t\t\tns, err := parseNamespace(it)\n\t\t\tif err != nil {","sourceCodeStart":654,"sourceCodeEnd":690,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/schema/parse.go#L654-L690","documentation":"When the parser reaches EOF it finalizes the schema by running resolveTokenizers over all parsed predicates, which validates that requested index tokenizers exist and are applicable. If that fails, parse wraps it as 'failed to enrich schema'. The root cause is in the wrapped inner error (an invalid or unknown tokenizer/index).","triggerScenarios":"Schema.Parse / ParseWithNamespace / ToDirectedEdges called with a schema declaring an index whose tokenizer name is misspelled or inapplicable to the type, e.g. 'hash' index on a float or a nonexistent tokenizer name.","commonSituations":"Typos in @index(hash) / @index(term) directives; using a tokenizer removed or not yet available in the Dgraph version; applying a string-only index to a dateTime/int predicate.","solutions":["Read the inner error (err chain) to identify the offending predicate and tokenizer","Correct the @index(...) directive to a valid tokenizer for the predicate's type (e.g. @index(exact) for string, @index(int) for int)","Check the Dgraph docs for tokenizers supported by your version","Validate the schema with a dry run against a test instance before applying"],"exampleFix":"// before\nschema := \"age: int @index(hash) .\"  // hash is not valid for int\n// after\nschema := \"age: int @index(int) .\"","handlingStrategy":"validation","validationCode":"validTokenizers := map[string]bool{\"exact\":true,\"hash\":true,\"term\":true,\"fulltext\":true,\"trigram\":true,\"int\":true,\"float\":true,\"bool\":true,\"datetime\":true}\nfor _, d := range indexDirectives(schemaStr) {\n    if !validTokenizers[d] {\n        return fmt.Errorf(\"unknown tokenizer: %s\", d)\n    }\n}","typeGuard":null,"tryCatchPattern":"if _, err := schema.Parse(s, 0, 1); err != nil {\n    var inner error\n    if errors.Unwrap(err) != nil { inner = errors.Unwrap(err) }\n    return fmt.Errorf(\"tokenizer enrichment failed (check @index directives): %w\", inner)\n}","preventionTips":["Cross-check @index tokenizers against the type of each predicate","Keep a curated list of tokenizers valid for your Dgraph version","Test schema changes on a staging instance first"],"tags":["dgraph","schema","tokenizer","indexing"],"backgroundTag":"invalid-index-tokenizer","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}