{"record":{"id":"4ad85412516176ff","repo":"ipfs/kubo","slug":"required-datastore-spec-entry-missing-from-config","errorCode":null,"errorMessage":"required Datastore.Spec entry missing from config file","messagePattern":"required Datastore\\.Spec entry missing from config file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/fsrepo/fsrepo.go","lineNumber":492,"sourceCode":"\nfunc (r *FSRepo) openKeystore() error {\n\tksp := filepath.Join(r.path, \"keystore\")\n\tks, err := keystore.NewFSKeystore(ksp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.keystore = ks\n\n\treturn nil\n}\n\n// openDatastore returns an error if the config file is not present.\nfunc (r *FSRepo) openDatastore() error {\n\tif r.config.Datastore.Type != \"\" || r.config.Datastore.Path != \"\" {\n\t\treturn fmt.Errorf(\"old style datatstore config detected\")\n\t} else if r.config.Datastore.Spec == nil {\n\t\treturn fmt.Errorf(\"required Datastore.Spec entry missing from config file\")\n\t}\n\tif r.config.Datastore.NoSync {\n\t\tlog.Warn(\"NoSync is now deprecated in favor of datastore specific settings. If you want to disable fsync on flatfs set 'sync' to false. See https://github.com/ipfs/kubo/blob/master/docs/datastores.md#flatfs.\")\n\t}\n\n\tdsc, err := AnyDatastoreConfig(r.config.Datastore.Spec)\n\tif err != nil {\n\t\treturn err\n\t}\n\tspec := dsc.DiskSpec()\n\n\toldSpec, err := r.readSpec()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif oldSpec != spec.String() {\n\t\treturn fmt.Errorf(\"datastore configuration of '%s' does not match what is on disk '%s'\",\n\t\t\toldSpec, spec.String())","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/repo/fsrepo/fsrepo.go#L474-L510","documentation":"Fired by FSRepo.openDatastore when the config has neither old-style Datastore.Type/Path nor a Datastore.Spec — i.e. the required modern datastore spec entry is absent from the config file. This guard catches corrupt or hand-trimmed configs; the repo cannot open without a datastore specification.","triggerScenarios":"Thrown at repo/fsrepo/fsrepo.go:492 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restore or add the Datastore.Spec section (e.g. from 'ipfs init' in a fresh repo)","Restore $IPFS_PATH/config from a backup if it was truncated","Re-init the repo if no backup exists"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}