{"record":{"id":"a3c165c217433dbe","repo":"cayleygraph/cayley","slug":"erroperationnotsupported","errorCode":"ErrOperationNotSupported","errorMessage":"this Operation is not supported","messagePattern":"this Operation is not supported","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graph/registry.go","lineNumber":25,"sourceCode":"//     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 {\n\t\tpanic(\"NewFunc must not be nil\")","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/graph/registry.go#L7-L43","documentation":"Sentinel error ErrOperationNotSupported from the quadstore registry (graph/registry.go:25). RegisterQuadStore was called for a store type whose QuadStoreRegistration has a nil InitFunc, and someone then invoked InitQuadStore for that store name. The registry only supports initialization for backends that registered an Init function.","triggerScenarios":"Calling InitQuadStore(store, dbpath, opts) for a store type that was registered with RegisterQuadStore without an InitStoreFunc (InitFunc == nil).","commonSituations":"Trying to initialize an in-memory or otherwise non-persistent backend that has no init step; copying a registration struct from a persistent backend but omitting the InitFunc field.","solutions":["Use the store directly (e.g. NewQuadStore / open it) instead of calling InitQuadStore for this backend type.","Only call InitQuadStore for backends documented as persistent/initializable (check the registered InitStoreFunc).","If you own the backend, provide an InitStoreFunc when calling RegisterQuadStore."],"exampleFix":"// before\nerr := quadstore.InitQuadStore(\"memstore\", \"/tmp/data\", opts)\n// after\nqs, err := graph.NewQuadStore(\"memstore\", \"\", opts) // in-memory store needs no Init","handlingStrategy":"validation","validationCode":"// only initialize backends that support Init\nname := \"memstore\"\nif _, err := graph.NewQuadStore(name, \"\", graph.Options{}); isInitUnsupported(err) { /* open instead of init */ }","typeGuard":null,"tryCatchPattern":"if err := quadstore.InitQuadStore(store, dbpath, opts); err != nil {\n    if errors.Is(err, graph.ErrOperationNotSupported) {\n        qs, err = graph.NewQuadStore(store, \"\", opts) // fall back to opening\n    }\n}","preventionTips":["Only call InitQuadStore for persistent backends documented to have an init step.","Check whether the backend registers an InitStoreFunc before initializing.","Treat ErrOperationNotSupported as a signal to open the store directly instead."],"tags":["registry","quadstore","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}