ipfs/kubo · error

no 'mountpoint' on mount

Error message

no 'mountpoint' on mount

What it means

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.

Source

Thrown at repo/fsrepo/datastores.go:119

	var res mountDatastoreConfig
	mounts, ok := params["mounts"].([]any)
	if !ok {
		return nil, fmt.Errorf("'mounts' field is missing or not an array")
	}
	for _, iface := range mounts {
		cfg, ok := iface.(map[string]any)
		if !ok {
			return nil, fmt.Errorf("expected map for mountpoint")
		}

		child, err := AnyDatastoreConfig(cfg)
		if err != nil {
			return nil, err
		}

		prefix, found := cfg["mountpoint"]
		if !found {
			return nil, fmt.Errorf("no 'mountpoint' on mount")
		}

		res.mounts = append(res.mounts, premount{
			ds:     child,
			prefix: ds.NewKey(prefix.(string)),
		})
	}
	sort.Slice(res.mounts,
		func(i, j int) bool {
			return res.mounts[i].prefix.String() > res.mounts[j].prefix.String()
		})

	return &res, nil
}

func (c *mountDatastoreConfig) DiskSpec() DiskSpec {
	cfg := map[string]any{"type": "mount"}
	mounts := make([]any, len(c.mounts))

View on GitHub (pinned to 329838acdf)

Solutions

  1. Add "mountpoint" (a key-path string like "/blocks" or "/") to every entry in the mounts array
  2. If this mount should cover everything, set "mountpoint": "/"
  3. Validate the spec: each mount must have both "mountpoint" and a valid "child"

Example fix

// before
{"child": {"type": "flatfs", "path": "blocks"}}
// after
{"mountpoint": "/blocks", "child": {"type": "flatfs", "path": "blocks"}}
Defensive patterns

Strategy: validation

Validate before calling

for _, e := range params["mounts"].([]any) {
	m, ok := e.(map[string]any)
	if !ok { continue }
	if _, ok := m["mountpoint"]; !ok {
		// add mountpoint, e.g. "/blocks" or "/"
	}
}

Type guard

func hasMountpoint(entry map[string]any) (string, bool) {
	p, ok := entry["mountpoint"].(string)
	return p, ok
}

Try / catch

ds, err := fsrepo.MountDatastoreConfig(spec)
if err != nil {
	if strings.Contains(err.Error(), "no 'mountpoint'") {
		return fmt.Errorf("mount entry lacks mountpoint: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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 "/").

Related errors


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/78e28d6d81c5b962. Report an issue: GitHub.