{"record":{"id":"d2ee282994b07152","repo":"dgraph-io/dgraph","slug":"json-map-is-followed-by-illegal-rune-c","errorCode":null,"errorMessage":"JSON map is followed by illegal rune \"%c\"","messagePattern":"JSON map is followed by illegal rune \"%c\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chunker/chunk.go","lineNumber":228,"sourceCode":"\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\n\tfor {\n\t\tch, err := jc.nextRune(r)\n\t\tif err != nil {","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/chunker/chunk.go#L210-L246","documentation":"GetIndexFactoryOptsFromSpec resolves the index factory by spec.Name, then extracts its Options. If no factory is registered under that name, it cannot produce Options and returns this error. It is the same registry-lookup failure as the create-spec variant, but on the options-extraction path.","triggerScenarios":"Calling GetIndexFactoryOptsFromSpec with a *pb.VectorIndexSpec whose Name does not match any registered index factory.","commonSituations":"Vector index name typo in schema; reading a schema produced by a Dgraph version with different factory names; code referencing an experimental factory that was renamed.","solutions":["Correct spec.Name to a registered factory name (verify via the factory registry).","Regenerate/re-apply the schema using the index names supported by your Dgraph version.","If options are optional in your flow, use GetIndexFactoryFromSpec first and skip when !found."],"exampleFix":"// before\nopts, err := tok.GetIndexFactoryOptsFromSpec(&pb.VectorIndexSpec{Name: \"vector-hnsw\"})\n// after\nif factory, found := tok.GetIndexFactoryFromSpec(spec); found {\n    opts, err = tok.GetIndexFactoryOptsFromSpec(spec)\n}","handlingStrategy":"validation","validationCode":"if _, found := tok.GetIndexFactoryFromSpec(spec); found {\n    opts, err = tok.GetIndexFactoryOptsFromSpec(spec)\n}","typeGuard":null,"tryCatchPattern":"opts, err := tok.GetIndexFactoryOptsFromSpec(spec)\nif err != nil {\n    if _, found := tok.GetIndexFactoryFromSpec(spec); !found {\n        return nil, fmt.Errorf(\"factory %q not registered in this build\", spec.Name)\n    }\n    return nil, err\n}","preventionTips":["Check factory existence with GetIndexFactoryFromSpec before extracting options.","Keep schema index names in sync with the Dgraph binary version.","Add a startup smoke test that resolves all schema index specs."],"tags":["dgraph","index-factory","options","schema"],"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"}