{"record":{"id":"1434fd0162c1f970","repo":"gastownhall/beads","slug":"configured-storage-backend-q-cannot-be-opened-as","errorCode":null,"errorMessage":"configured storage backend %q cannot be opened as Dolt","messagePattern":"configured storage backend %q cannot be opened as Dolt","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/storage/dolt/open.go","lineNumber":94,"sourceCode":"\tcfg.ServerPortSource = resolved.PortSource\n\tcfg.ServerPortSharedServer = resolved.PortSharedServer\n}\n\n// requireDoltBackend keeps metadata-driven callers from bypassing the storage\n// factory and interpreting another backend's workspace as Dolt. Removed backend\n// identifiers deliberately remain recognizable in metadata so this check can fail\n// closed instead of opening a new, empty Dolt database.\nfunc requireDoltBackend(fileCfg *configfile.Config) error {\n\tswitch fileCfg.Backend {\n\tcase configfile.BackendPostgres, configfile.BackendMySQL, configfile.BackendSQLite:\n\t\treturn fmt.Errorf(\"configured storage backend %q is no longer supported and cannot be opened as Dolt: %s\", fileCfg.Backend, configfile.RemovedBackendDetail(fileCfg.Backend))\n\t}\n\tif !configfile.IsSupportedBackend(fileCfg.Backend) {\n\t\treturn fmt.Errorf(\"configured storage backend %q in metadata.json is not recognized and cannot be opened as Dolt; %s\", fileCfg.Backend, configfile.BackendNotOpenedGuarantee)\n\t}\n\tbackend := fileCfg.GetBackend()\n\tif backend != configfile.BackendDolt {\n\t\treturn fmt.Errorf(\"configured storage backend %q cannot be opened as Dolt\", backend)\n\t}\n\treturn nil\n}\n\n// NewFromConfig creates a DoltStore based on the metadata.json configuration.\n// beadsDir is the path to the .beads directory.\nfunc NewFromConfig(ctx context.Context, beadsDir string) (*DoltStore, error) {\n\treturn NewFromConfigWithOptions(ctx, beadsDir, nil)\n}\n\n// NewFromConfigWithCLIOptions creates a DoltStore using the standalone CLI\n// auto-start policy from cmd/bd/main.go. This is for CLI helper paths like\n// `bd doctor` that should behave the same way as normal top-level CLI commands\n// while still honoring externally managed server mode.\nfunc NewFromConfigWithCLIOptions(ctx context.Context, beadsDir string, cfg *Config) (*DoltStore, error) {\n\tfileCfg, err := configfile.Load(beadsDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"loading config: %w\", err)","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/open.go#L76-L112","documentation":"The backend in metadata.json is supported and recognized, but it is not Dolt (e.g. a newly supported backend this Dolt-specific open path can't handle). requireDoltBackend rejects the open because this factory only knows how to open Dolt workspaces.","triggerScenarios":"Calling NewFromConfigWithOptions / NewFromConfigWithCLIOptions when fileCfg.GetBackend() returns a valid, supported backend other than configfile.BackendDolt.","commonSituations":"Using a Dolt-specific store constructor against a workspace configured for another supported backend; switching backends in config without switching the open path; tooling that rewrites metadata.json to a new backend value.","solutions":["Open the store with the constructor/factory matching the configured backend instead of the Dolt one","If Dolt is intended, set backend to \"dolt\" in metadata.json","Use the generic storage factory to dispatch on the configured backend automatically","Verify which backend your .beads directory actually contains before choosing the open path"],"exampleFix":"// before: forcing the Dolt constructor\nstore, err := dolt.NewFromConfigWithOptions(beadsDir, opts)\n\n// after: dispatch on configured backend\nstore, err := storage.OpenFromConfig(beadsDir, opts)","handlingStrategy":"fallback","validationCode":"// Dispatch on backend instead of assuming Dolt\ncfg, _ := configfile.Load(beadsDir)\nif cfg.GetBackend() != configfile.BackendDolt {\n    return openNonDoltStore(beadsDir, cfg)\n}","typeGuard":null,"tryCatchPattern":"store, err := dolt.NewFromConfigWithOptions(beadsDir, opts)\nif err != nil && strings.HasSuffix(err.Error(), \"cannot be opened as Dolt\") {\n    // fall back to the generic backend-dispatching constructor\n    store, err = storage.OpenFromConfig(beadsDir, opts)\n}","preventionTips":["Use the generic storage factory instead of Dolt-specific constructors unless Dolt is guaranteed","Confirm backend type when scripting against multiple .beads directories","Keep backend configuration and open paths consistent"],"tags":["storage","backend","configuration","factory"],"backgroundTag":"unsupported-storage-backend","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}