{"record":{"id":"78e28d6d81c5b962","repo":"ipfs/kubo","slug":"no-mountpoint-on-mount","errorCode":null,"errorMessage":"no 'mountpoint' on mount","messagePattern":"no 'mountpoint' on mount","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/fsrepo/datastores.go","lineNumber":119,"sourceCode":"\tvar res mountDatastoreConfig\n\tmounts, ok := params[\"mounts\"].([]any)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"'mounts' field is missing or not an array\")\n\t}\n\tfor _, iface := range mounts {\n\t\tcfg, ok := iface.(map[string]any)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"expected map for mountpoint\")\n\t\t}\n\n\t\tchild, err := AnyDatastoreConfig(cfg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tprefix, found := cfg[\"mountpoint\"]\n\t\tif !found {\n\t\t\treturn nil, fmt.Errorf(\"no 'mountpoint' on mount\")\n\t\t}\n\n\t\tres.mounts = append(res.mounts, premount{\n\t\t\tds:     child,\n\t\t\tprefix: ds.NewKey(prefix.(string)),\n\t\t})\n\t}\n\tsort.Slice(res.mounts,\n\t\tfunc(i, j int) bool {\n\t\t\treturn res.mounts[i].prefix.String() > res.mounts[j].prefix.String()\n\t\t})\n\n\treturn &res, nil\n}\n\nfunc (c *mountDatastoreConfig) DiskSpec() DiskSpec {\n\tcfg := map[string]any{\"type\": \"mount\"}\n\tmounts := make([]any, len(c.mounts))","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/repo/fsrepo/datastores.go#L101-L137","documentation":"MountDatastoreConfig requires each mount entry to carry a \"mountpoint\" key that defines the datastore prefix path under which the child datastore is mounted. Missing key means the mount table cannot be built, so the error is returned.","triggerScenarios":"A mount entry map in the \"mounts\" array that has \"child\" (and maybe \"type\") but no \"mountpoint\" key, causing the cfg[\"mountpoint\"] lookup to fail.","commonSituations":"Config where a mount object was written with only the child spec; copy-paste that dropped the mountpoint line; generated specs from tooling that omit the prefix for the root mount (should be \"/\").","solutions":["Add \"mountpoint\" (a key-path string like \"/blocks\" or \"/\") to every entry in the mounts array","If this mount should cover everything, set \"mountpoint\": \"/\"","Validate the spec: each mount must have both \"mountpoint\" and a valid \"child\""],"exampleFix":"// before\n{\"child\": {\"type\": \"flatfs\", \"path\": \"blocks\"}}\n// after\n{\"mountpoint\": \"/blocks\", \"child\": {\"type\": \"flatfs\", \"path\": \"blocks\"}}","handlingStrategy":"validation","validationCode":"for _, e := range params[\"mounts\"].([]any) {\n\tm, ok := e.(map[string]any)\n\tif !ok { continue }\n\tif _, ok := m[\"mountpoint\"]; !ok {\n\t\t// add mountpoint, e.g. \"/blocks\" or \"/\"\n\t}\n}","typeGuard":"func hasMountpoint(entry map[string]any) (string, bool) {\n\tp, ok := entry[\"mountpoint\"].(string)\n\treturn p, ok\n}","tryCatchPattern":"ds, err := fsrepo.MountDatastoreConfig(spec)\nif err != nil {\n\tif strings.Contains(err.Error(), \"no 'mountpoint'\") {\n\t\treturn fmt.Errorf(\"mount entry lacks mountpoint: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Include a \"mountpoint\" key path (e.g. \"/blocks\", \"/\") in every mount entry","Use \"/\" for a catch-all mount","Validate each mount object has mountpoint plus a valid child before calling"],"tags":["datastore","config","mount","validation","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"}