{"record":{"id":"0c2d8104ea45e112","repo":"dgraph-io/dgraph","slug":"illegal-rune-found-c-expecting","errorCode":null,"errorMessage":"illegal rune found \"%c\", expecting {","messagePattern":"illegal rune found \"%c\", expecting \\{","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chunker/chunk.go","lineNumber":225,"sourceCode":"\t\t\tif !jc.inList {\n\t\t\t\treturn nil, errors.New(\"JSON map is followed by an extraneous ]\")\n\t\t\t}\n\n\t\t\t// validate that there are no more non-space chars after the ]\n\t\t\tif slurpSpace(r) != io.EOF {\n\t\t\t\treturn nil, errors.New(\"not all of JSON file consumed\")\n\t\t\t}\n\n\t\t\tif _, err := out.WriteRune(']'); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn out, io.EOF\n\t\t}\n\n\t\t// In the non-termination cases, ensure at least one map has been consumed, and\n\t\t// the only allowed char after the map is \",\".\n\t\tif out.Len() == 1 { // 1 represents the [ inserted before the for loop\n\t\t\treturn nil, fmt.Errorf(\"illegal rune found \\\"%c\\\", expecting {\", ch)\n\t\t}\n\t\tif ch != ',' {\n\t\t\treturn nil, fmt.Errorf(\"JSON map is followed by illegal rune \\\"%c\\\"\", ch)\n\t\t}\n\t}\n\tif _, err := out.WriteRune(']'); err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}\n\n// consumeMap consumes the next map from the reader, and stores the result into the buffer out.\n// After ignoring spaces, if the reader does not begin with {, no rune will be consumed\n// from the reader.\nfunc (jc *jsonChunker) consumeMap(r *bufio.Reader, out *bytes.Buffer) error {\n\t// Just find the matching closing brace. Let the JSON-to-nquad parser in the mapper worry\n\t// about whether everything in between is valid JSON or not.\n\tdepth := 0","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/chunker/chunk.go#L207-L243","documentation":"GetFactoryCreateSpecFromSpec looks up the registered index factory matching the VectorIndexSpec's Name. When no factory with that name exists in the registry, the spec cannot be turned into a FactoryCreateSpec, so the library aborts. This typically means the predicate's index type in the schema references a tokenizer/index factory Dgraph does not know about.","triggerScenarios":"Calling GetFactoryCreateSpecFromSpec (directly or via getOrCreateIndexer, rebuildTokIndex, needsTokIndexRebuild, needsVectorIndexEdgesRebuild, FactoryCreateSpec) with a *pb.VectorIndexSpec whose Name is not a registered index factory name.","commonSituations":"Schema JSON altered by hand with a typo in the index name; schema written by a newer/older Dgraph version using an index factory removed or renamed; a dropped custom index plugin not registered at startup.","solutions":["Check spec.Name against the registered index factories and fix the schema's index name (typo/case).","Align the Dgraph binary version with the schema: upgrade or downgrade so the factory exists.","If a custom factory was expected, register it before calling GetFactoryCreateSpecFromSpec.","Drop and re-apply the offending predicate schema with a supported index type."],"exampleFix":"// before\nspec := &pb.VectorIndexSpec{Name: \"hnsw-cosine\"}\nspec2, err := tok.GetFactoryCreateSpecFromSpec(spec)\n// after\nspec := &pb.VectorIndexSpec{Name: \"hnsw\"} // use a registered factory name\nspec2, err := tok.GetFactoryCreateSpecFromSpec(spec)","handlingStrategy":"validation","validationCode":"if _, found := tok.GetIndexFactoryFromSpec(spec); !found {\n    return fmt.Errorf(\"unsupported vector index: %q\", spec.Name)\n}\n// safe: tok.GetFactoryCreateSpecFromSpec(spec)","typeGuard":null,"tryCatchPattern":"spec2, err := tok.GetFactoryCreateSpecFromSpec(spec)\nif err != nil && strings.Contains(err.Error(), \"cannot find index factory named\") {\n    // fall back to a supported factory or surface a schema-fix hint\n}","preventionTips":["Never hand-edit index factory names in schema files; use documented names only.","Pin and test the Dgraph version alongside your schema.","Validate the whole schema at deploy time by resolving every index spec against the registry."],"tags":["dgraph","index-factory","schema","tokenizer"],"backgroundTag":"unknown-index-factory-name","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}