cayleygraph/cayley · error
ErrOperationNotSupported
ErrOperationNotSupported
Error message
this Operation is not supported
What it means
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.
Source
Thrown at graph/registry.go:25
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package graph
import (
"fmt"
"sort"
)
var (
ErrQuadStoreNotRegistred = fmt.Errorf("this QuadStore is not registered")
ErrQuadStoreNotPersistent = fmt.Errorf("cannot specify address for non-persistent backend")
ErrOperationNotSupported = fmt.Errorf("this Operation is not supported")
)
var storeRegistry = make(map[string]QuadStoreRegistration)
type NewStoreFunc func(string, Options) (QuadStore, error)
type InitStoreFunc func(string, Options) error
type UpgradeStoreFunc func(string, Options) error
type QuadStoreRegistration struct {
NewFunc NewStoreFunc
UpgradeFunc UpgradeStoreFunc
InitFunc InitStoreFunc
IsPersistent bool
}
func RegisterQuadStore(name string, register QuadStoreRegistration) {
if register.NewFunc == nil {
panic("NewFunc must not be nil")View on GitHub (pinned to 81dcd7d73e)
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.
Example fix
// before
err := quadstore.InitQuadStore("memstore", "/tmp/data", opts)
// after
qs, err := graph.NewQuadStore("memstore", "", opts) // in-memory store needs no Init Defensive patterns
Strategy: validation
Validate before calling
// only initialize backends that support Init
name := "memstore"
if _, err := graph.NewQuadStore(name, "", graph.Options{}); isInitUnsupported(err) { /* open instead of init */ } Try / catch
if err := quadstore.InitQuadStore(store, dbpath, opts); err != nil {
if errors.Is(err, graph.ErrOperationNotSupported) {
qs, err = graph.NewQuadStore(store, "", opts) // fall back to opening
}
} Prevention
- 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.
When it happens
Trigger: Calling InitQuadStore(store, dbpath, opts) for a store type that was registered with RegisterQuadStore without an InitStoreFunc (InitFunc == nil).
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- ErrDatabaseExists
- ErrNotInitialized
- ErrQuadExists
- ErrQuadNotExist
- replication: name '" + name + "' is not registered
AI-assisted analysis of cayleygraph/cayley@81dcd7d73e (2026-09-06).
Data as JSON: /api/errors/a3c165c217433dbe.
Report an issue: GitHub.