{"record":{"id":"2f7b82b00dc47d5b","repo":"cayleygraph/cayley","slug":"replication-name-name-is-not-registered","errorCode":null,"errorMessage":"replication: name '\" + name + \"' is not registered","messagePattern":"replication: name '\" \\+ name \\+ \"' is not registered","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graph/quadwriter.go","lineNumber":172,"sourceCode":"\t// Close cleans up replication and closes the writing aspect of the database.\n\tClose() error\n}\n\ntype NewQuadWriterFunc func(QuadStore, Options) (QuadWriter, error)\n\nvar writerRegistry = make(map[string]NewQuadWriterFunc)\n\nfunc RegisterWriter(name string, newFunc NewQuadWriterFunc) {\n\tif _, found := writerRegistry[name]; found {\n\t\tpanic(\"already registered QuadWriter \" + name)\n\t}\n\twriterRegistry[name] = newFunc\n}\n\nfunc NewQuadWriter(name string, qs QuadStore, opts Options) (QuadWriter, error) {\n\tnewFunc, hasNew := writerRegistry[name]\n\tif !hasNew {\n\t\treturn nil, errors.New(\"replication: name '\" + name + \"' is not registered\")\n\t}\n\treturn newFunc(qs, opts)\n}\n\nfunc WriterMethods() []string {\n\tt := make([]string, 0, len(writerRegistry))\n\tfor n := range writerRegistry {\n\t\tt = append(t, n)\n\t}\n\treturn t\n}\n\ntype BatchWriter interface {\n\tquad.WriteCloser\n\tFlush() error\n}\n\n// NewWriter creates a quad writer for a given QuadStore.","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/graph/quadwriter.go#L154-L190","documentation":"NewQuadWriter returns this error when the requested replication/writer name has not been registered in writerRegistry. Writers (single, replicated, etc.) register themselves via RegisterQuadWriter, usually in their package's init(), so an unregistered name means that package was never imported or the name is misspelled.","triggerScenarios":"Calling NewQuadWriter(name, qs, opts) with a name not in writerRegistry; opening a database whose config specifies a quad writer name (e.g. via open/openDatabase) that no registered writer provides; forgetting to blank-import the writer package (e.g. _ \"github.com/google/cayley/writer\").","commonSituations":"Typo in config quad_writer option (e.g. \"replicate\" vs \"replicated\"); constructing a custom build that dropped the writer package import; upgrading Cayley where a writer was renamed or removed.","solutions":["Check spelling of the writer name; list valid names with graph.WriterMethods()","Blank-import the writer packages so their init() registers them: _ \"github.com/google/cayley/writer\"","Fix the quad_writer option in your config file to a registered method like \"single\"","If using a custom writer, call RegisterQuadWriter with your factory function before NewQuadWriter"],"exampleFix":"// before\nqw, err := graph.NewQuadWriter(\"replicated\", qs, opts) // not registered\n// after\nimport _ \"github.com/google/cayley/writer\" // registers built-in writers\nqw, err := graph.NewQuadWriter(\"single\", qs, opts)","handlingStrategy":"validation","validationCode":"valid := false\nfor _, m := range graph.WriterMethods() {\n    if m == name { valid = true; break }\n}\nif !valid {\n    return fmt.Errorf(\"unknown quad writer %q; valid: %v\", name, graph.WriterMethods())\n}","typeGuard":null,"tryCatchPattern":"qw, err := graph.NewQuadWriter(name, qs, opts)\nif err != nil {\n    if strings.Contains(err.Error(), \"is not registered\") {\n        // fall back to a known writer or surface config guidance\n    }\n    return err\n}","preventionTips":["Validate the quad_writer config option against graph.WriterMethods() at startup","Blank-import writer packages so init() registration runs","Keep writer names in a constants file instead of free-form config strings","Re-check writer names after upgrading Cayley (renames happen)"],"tags":["registry","writer","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"81dcd7d73e45136bc0d01802a8ba4685d8a533eb","analyzedAt":"2026-09-06T06:14:12.358Z","contentChangedAt":"2026-09-06T06:14:12.358Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}