{"record":{"id":"4904a9b420565d3f","repo":"dgraph-io/dgraph","slug":"invalid-tokenizer-s","errorCode":null,"errorMessage":"Invalid tokenizer %s","messagePattern":"Invalid tokenizer (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"schema/parse.go","lineNumber":444,"sourceCode":"\t\t}\n\n\t\tif !HasTokenizerOrVectorIndexSpec(schema) &&\n\t\t\tschema.Directive == pb.SchemaUpdate_INDEX {\n\t\t\treturn errors.Errorf(\n\t\t\t\t\"Require type of tokenizer for pred: %s of type: %s for indexing.\",\n\t\t\t\tschema.Predicate, typ.Name())\n\t\t} else if HasTokenizerOrVectorIndexSpec(schema) &&\n\t\t\tschema.Directive != pb.SchemaUpdate_INDEX {\n\t\t\treturn errors.Errorf(\"Tokenizers present without indexing on attr %s\",\n\t\t\t\tx.ParseAttr(schema.Predicate))\n\t\t}\n\t\t// check for valid tokenizer types and duplicates\n\t\tvar seen = make(map[string]bool)\n\t\tvar seenSortableTok bool\n\t\tfor _, t := range schema.Tokenizer {\n\t\t\ttokenizer, has := tok.GetTokenizer(t)\n\t\t\tif !has {\n\t\t\t\treturn errors.Errorf(\"Invalid tokenizer %s\", t)\n\t\t\t}\n\t\t\ttokenizerType, ok := types.TypeForName(tokenizer.Type())\n\t\t\tx.AssertTrue(ok) // Type is validated during tokenizer loading.\n\t\t\tif tokenizerType != typ {\n\t\t\t\treturn errors.Errorf(\"Tokenizer: %s isn't valid for predicate: %s of type: %s\",\n\t\t\t\t\ttokenizer.Name(), x.ParseAttr(schema.Predicate), typ.Name())\n\t\t\t}\n\t\t\tif _, ok := seen[tokenizer.Name()]; !ok {\n\t\t\t\tseen[tokenizer.Name()] = true\n\t\t\t} else {\n\t\t\t\treturn errors.Errorf(\"Duplicate tokenizers present for attr %s\",\n\t\t\t\t\tx.ParseAttr(schema.Predicate))\n\t\t\t}\n\t\t\tif tokenizer.IsSortable() {\n\t\t\t\tif seenSortableTok {\n\t\t\t\t\treturn errors.Errorf(\"More than one sortable index encountered for: %v\",\n\t\t\t\t\t\tschema.Predicate)\n\t\t\t\t}","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/schema/parse.go#L426-L462","documentation":"Each tokenizer listed for an indexed predicate must be a registered tokenizer known to Dgraph (tok.GetTokenizer). If the name string doesn't match any built-in or loaded tokenizer, the schema update fails with \"Invalid tokenizer <name>\".","triggerScenarios":"Schema alteration listing a nonexistent tokenizer name, e.g. `@index(hashx)`, `@index(string)`, or misspellings like `@index(full-text)`; empty tokenizer strings; names removed/renamed between Dgraph versions.","commonSituations":"Typos in hand-edited DQL schema; copying tokenizers from other databases (e.g. 'trigram', 'ngram'); upgrading/downgrading Dgraph where a tokenizer was added or renamed; case-sensitivity mistakes ('Hash' vs 'hash').","solutions":["Use a valid tokenizer name — for strings: hash, exact, term, fulltext, trigram, wikidata (where available); int/float/datetime/bool take their default single tokenizer.","Run the schema alteration again with corrected names.","Check the Dgraph docs for your version's supported tokenizer list.","Note the type must also match (see the paired 'isn't valid for predicate' error)."],"exampleFix":"// before\nname: string @index(full-text) .\n// after\nname: string @index(fulltext) .","handlingStrategy":"validation","validationCode":"const VALID = new Set(['hash','exact','term','fulltext','trigram','int','float','datetime','year','month','day','hour','geo','default']);\nfunction validateTokenizers(line) {\n  const m = line.match(/@index\\s*\\(([^)]*)\\)/);\n  if (!m) return;\n  for (const t of m[1].split(',').map(s => s.trim())) {\n    if (!VALID.has(t)) throw new Error(`invalid tokenizer: ${t}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await dgraph.Alter(ctx, op);\n} catch (e) {\n  if (String(e).includes('Invalid tokenizer')) {\n    // correct the tokenizer name against your Dgraph version's docs\n  }\n  throw e;\n}","preventionTips":["Keep a whitelist of tokenizer names per Dgraph version in your tooling","Avoid copying tokenizer names from other databases","Test schema alterations on a staging Dgraph before production"],"tags":["dgraph","schema","tokenizer"],"backgroundTag":"schema-validation-failed","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}