{"record":{"id":"02261d5ea2fde9c8","repo":"dgraph-io/dgraph","slug":"uid-must-be-present-and-non-zero-while-deleting-ed","errorCode":null,"errorMessage":"UID must be present and non-zero while deleting edges","messagePattern":"UID must be present and non-zero while deleting edges","errorType":"validation","errorClass":"errEmptyUID","httpStatus":null,"severity":"error","filePath":"chunker/json_parser.go","lineNumber":30,"sourceCode":"\t\"fmt\"\n\t\"math/rand\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync/atomic\"\n\t\"unicode\"\n\n\t\"github.com/twpayne/go-geom\"\n\t\"github.com/twpayne/go-geom/encoding/geojson\"\n\n\t\"github.com/dgraph-io/dgo/v250/protos/api\"\n\t\"github.com/dgraph-io/dgraph/v25/protos/pb\"\n\t\"github.com/dgraph-io/dgraph/v25/types\"\n\t\"github.com/dgraph-io/dgraph/v25/types/facets\"\n\t\"github.com/dgraph-io/dgraph/v25/x\"\n\t\"github.com/dgraph-io/simdjson-go\"\n)\n\nvar errEmptyUID = errors.New(\"UID must be present and non-zero while deleting edges\")\n\nfunc stripSpaces(str string) string {\n\treturn strings.Map(func(r rune) rune {\n\t\tif unicode.IsSpace(r) {\n\t\t\treturn -1\n\t\t}\n\n\t\treturn r\n\t}, str)\n}\n\n// handleBasicFacetsType parses a facetVal to string/float64/bool/datetime type.\nfunc handleBasicFacetsType(key string, facetVal interface{}) (*api.Facet, error) {\n\tvar jsonValue interface{}\n\tvar valueType api.Facet_ValType\n\tswitch v := facetVal.(type) {\n\tcase string:\n\t\tif t, err := types.ParseTime(v); err == nil {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/chunker/json_parser.go#L12-L48","documentation":"The exact tokenizer only accepts Go string values; Tokens() does a type assertion v.(string) and errors for anything else. Exact indices are string-only by design, so non-string scalar values (int, float, bool, datetime) cannot be tokenized.","triggerScenarios":"Calling ExactTokenizer.Tokens(v) with a value whose dynamic type is not string — e.g. passing an int64/float64/bool into tokenization for a predicate indexed as exact.","commonSituations":"Schema declares @index(exact) on an int/float/bool/datetime predicate; code path feeding raw values to the tokenizer without converting to string first.","solutions":["Change the predicate type in the schema to string if exact indexing is needed, or remove @index(exact) from non-string predicates.","Convert the value to a string before tokenizing if string comparison semantics are acceptable.","Use the appropriate tokenizer/type combination (e.g. int predicates need no exact tokenizer)."],"exampleFix":"// before\npred: \"age\" @index(exact) . // age is int\ntok.ExactTokenizer{}.Tokens(42) // error\n// after\npred: \"name\" @index(exact) .\ntok.ExactTokenizer{}.Tokens(\"alice\")","handlingStrategy":"type-guard","validationCode":"if s, ok := v.(string); !ok {\n    return fmt.Errorf(\"exact tokenizer requires string, got %T\", v)\n}","typeGuard":"func isString(v interface{}) bool { _, ok := v.(string); return ok }","tryCatchPattern":"tokens, err := exactTok.Tokens(v)\nif err != nil && strings.Contains(err.Error(), \"only supported for string types\") {\n    return nil, fmt.Errorf(\"predicate must be string type for exact index; got %T\", v)\n}","preventionTips":["Only declare @index(exact) on string predicates.","Type-assert to string before any tokenizer call on interface{} values.","Validate schema predicate type vs tokenizers at schema-apply time."],"tags":["dgraph","tokenizer","exact-index","type-mismatch"],"backgroundTag":"tokenizer-type-mismatch","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}