cayleygraph/cayley · error
replication: name '" + name + "' is not registered
Error message
replication: name '" + name + "' is not registered
What it means
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.
Source
Thrown at graph/quadwriter.go:172
// Close cleans up replication and closes the writing aspect of the database.
Close() error
}
type NewQuadWriterFunc func(QuadStore, Options) (QuadWriter, error)
var writerRegistry = make(map[string]NewQuadWriterFunc)
func RegisterWriter(name string, newFunc NewQuadWriterFunc) {
if _, found := writerRegistry[name]; found {
panic("already registered QuadWriter " + name)
}
writerRegistry[name] = newFunc
}
func NewQuadWriter(name string, qs QuadStore, opts Options) (QuadWriter, error) {
newFunc, hasNew := writerRegistry[name]
if !hasNew {
return nil, errors.New("replication: name '" + name + "' is not registered")
}
return newFunc(qs, opts)
}
func WriterMethods() []string {
t := make([]string, 0, len(writerRegistry))
for n := range writerRegistry {
t = append(t, n)
}
return t
}
type BatchWriter interface {
quad.WriteCloser
Flush() error
}
// NewWriter creates a quad writer for a given QuadStore.View on GitHub (pinned to 81dcd7d73e)
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
Example fix
// before
qw, err := graph.NewQuadWriter("replicated", qs, opts) // not registered
// after
import _ "github.com/google/cayley/writer" // registers built-in writers
qw, err := graph.NewQuadWriter("single", qs, opts) Defensive patterns
Strategy: validation
Validate before calling
valid := false
for _, m := range graph.WriterMethods() {
if m == name { valid = true; break }
}
if !valid {
return fmt.Errorf("unknown quad writer %q; valid: %v", name, graph.WriterMethods())
} Try / catch
qw, err := graph.NewQuadWriter(name, qs, opts)
if err != nil {
if strings.Contains(err.Error(), "is not registered") {
// fall back to a known writer or surface config guidance
}
return err
} Prevention
- 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)
When it happens
Trigger: 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").
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- ErrQuadStoreNotPersistent
- HTTP Request needed
- ErrEmptyPath
- ErrQuadStoreNotRegistred
- ErrOperationNotSupported
AI-assisted analysis of cayleygraph/cayley@81dcd7d73e (2026-09-06).
Data as JSON: /api/errors/2f7b82b00dc47d5b.
Report an issue: GitHub.