{"record":{"id":"93064bd31cf31466","repo":"cayleygraph/cayley","slug":"errquadstorenotpersistent","errorCode":"ErrQuadStoreNotPersistent","errorMessage":"cannot specify address for non-persistent backend","messagePattern":"cannot specify address for non-persistent backend","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graph/registry.go","lineNumber":24,"sourceCode":"//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage graph\n\nimport (\n\t\"fmt\"\n\t\"sort\"\n)\n\nvar (\n\tErrQuadStoreNotRegistred  = fmt.Errorf(\"this QuadStore is not registered\")\n\tErrQuadStoreNotPersistent = fmt.Errorf(\"cannot specify address for non-persistent backend\")\n\tErrOperationNotSupported  = fmt.Errorf(\"this Operation is not supported\")\n)\n\nvar storeRegistry = make(map[string]QuadStoreRegistration)\n\ntype NewStoreFunc func(string, Options) (QuadStore, error)\ntype InitStoreFunc func(string, Options) error\ntype UpgradeStoreFunc func(string, Options) error\n\ntype QuadStoreRegistration struct {\n\tNewFunc      NewStoreFunc\n\tUpgradeFunc  UpgradeStoreFunc\n\tInitFunc     InitStoreFunc\n\tIsPersistent bool\n}\n\nfunc RegisterQuadStore(name string, register QuadStoreRegistration) {\n\tif register.NewFunc == nil {","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/graph/registry.go#L6-L42","documentation":"ErrQuadStoreNotPersistent is returned when a network address (KeyAddress) is supplied to a backend whose registration has IsPersistent == false. Non-persistent backends (e.g. memstore) cannot listen on an address. The CLI converts this into \"...did you mean -i flag?\".","triggerScenarios":"Running cayley with an --address/-a against a non-persistent storage backend, or calling NewQuadStore/openForQueries with a non-empty dbpath for such a backend.","commonSituations":"Config leftover from a previous persistent backend (bolt/leveldb) while switching to memstore; assuming memstore supports serving on a port; copy-pasted startup scripts.","solutions":["Remove the address setting (viper.Set(KeyAddress, \"\")) when using a non-persistent backend","Switch to a persistent backend (bolt, leveldb) if you need an address/HTTP serving of stored data","Use the -i/--init flag flow the CLI suggests when loading data into a non-persistent store","Check store registration flags before configuring an address"],"exampleFix":"// before\nviper.Set(\"address\", \":64210\")\nviper.Set(\"storage\", \"memstore\") // not persistent -> error\n// after\nviper.Set(\"storage\", \"bolt\") // persistent backend, or clear the address\nviper.Set(\"address\", \":64210\")","handlingStrategy":"try-catch","validationCode":"r, err := graph.NewQuadStore(name, \"\", nil) // or check registration flags via docs\npersistent := name == \"bolt\" || name == \"leveldb\" // per registration metadata\nif addr != \"\" && !persistent { clear addr before opening }","typeGuard":"func backendSupportsAddress(name string) bool {\n    switch name { case \"memstore\": return false; default: return true }\n}","tryCatchPattern":"h, err := openDatabase()\nif errors.Is(err, graph.ErrQuadStoreNotPersistent) {\n    viper.Set(KeyAddress, \"\")\n    h, err = openDatabase() // retry without address\n}","preventionTips":["Clear stale address settings when switching backends","Only use -a/--address with persistent stores","Validate backend/address combination at startup","Read backend registration flags (IsPersistent) before configuring"],"tags":["registry","configuration","persistence"],"backgroundTag":"invalid-config-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"}