{"record":{"id":"9f4e890a8c06e8fa","repo":"ipfs/kubo","slug":"unknown-datastore-type-s","errorCode":null,"errorMessage":"unknown datastore type: %s","messagePattern":"unknown datastore type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/fsrepo/datastores.go","lineNumber":85,"sourceCode":"\t_, ok := datastores[name]\n\tif ok {\n\t\treturn fmt.Errorf(\"already have a datastore named %q\", name)\n\t}\n\n\tdatastores[name] = dsc\n\treturn nil\n}\n\n// AnyDatastoreConfig returns a DatastoreConfig from a spec based on\n// the \"type\" parameter.\nfunc AnyDatastoreConfig(params map[string]any) (DatastoreConfig, error) {\n\twhich, ok := params[\"type\"].(string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"'type' field missing or not a string\")\n\t}\n\tfun, ok := datastores[which]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unknown datastore type: %s\", which)\n\t}\n\treturn fun(params)\n}\n\ntype mountDatastoreConfig struct {\n\tmounts []premount\n}\n\ntype premount struct {\n\tds     DatastoreConfig\n\tprefix ds.Key\n}\n\n// MountDatastoreConfig returns a mount DatastoreConfig from a spec.\nfunc MountDatastoreConfig(params map[string]any) (DatastoreConfig, error) {\n\tvar res mountDatastoreConfig\n\tmounts, ok := params[\"mounts\"].([]any)\n\tif !ok {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/repo/fsrepo/datastores.go#L67-L103","documentation":"AnyDatastoreConfig could not map the 'type' field of a Datastore.Spec entry to a registered datastore builder: the configured type string is not one of the built-in types (mount, measure, levelds, flatfs, etc.) and no plugin registered one under that name.","triggerScenarios":"AnyDatastoreConfig called with params[\"type\"] set to a string that is not a key of the datastores map (e.g. \"goleveldb\", \"flatfs \" with whitespace, wrong case).","commonSituations":"Typo in the datastore type in the config's Datastore.Spec; copying a spec from another implementation or a newer kubo version that registers types this build does not have; extra whitespace or casing in the type name.","solutions":["Use a supported type: levelds, flatfs, mount, measure, badgerds (if enabled), memds, or a plugin-provided type","Check for typos in Datastore.Spec.type","See docs/datastores.md for the supported types and examples"],"exampleFix":"// before\nspec := map[string]any{\"type\": \"flatNs\", \"path\": \"/datastore\"}\n// after\nspec := map[string]any{\"type\": \"flatfs\", \"path\": \"/datastore\"}","handlingStrategy":"validation","validationCode":"t, _ := params[\"type\"].(string)\nknown := map[string]bool{\"mounts\":true,\"flatfs\":true,\"levelds\":true,\"log\":true,\"measure\":true}\nif !known[t] { /* fix type name before calling */ }","typeGuard":"func knownDatastoreType(params map[string]any) bool {\n\tt, ok := params[\"type\"].(string)\n\treturn ok && t != \"\"\n}","tryCatchPattern":"ds, err := fsrepo.AnyDatastoreConfig(spec)\nif err != nil {\n\tif strings.HasPrefix(err.Error(), \"unknown datastore type\") {\n\t\treturn fmt.Errorf(\"spec type %q not supported by this build: %w\", spec[\"type\"], err)\n\t}\n\treturn err\n}","preventionTips":["Copy datastore type names exactly as registered in repo/fsrepo/datastores.go","Trim whitespace and keep consistent casing in \"type\" values","Check release notes when upgrading so specs use types supported by the new build"],"tags":["datastore","config","unknown-type","go"],"backgroundTag":"datastore-spec-invalid","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"}