ipfs/kubo · info · ErrNotMounted

not mounted

Error message

not mounted

What it means

ErrNotMounted is the sentinel error ('not mounted') returned by mount.Unmount when the FUSE mount is not currently active. Callers should compare with errors.Is/mount.ErrNotMounted to treat it as a benign no-op rather than a failure.

Source

Thrown at fuse/mount/fuse.go:15

// FUSE mount/unmount lifecycle. go-fuse only builds on linux, darwin, and freebsd.
//go:build (linux || darwin || freebsd) && !nofuse

package mount

import (
	"errors"
	"fmt"
	"sync"

	"github.com/hanwen/go-fuse/v2/fs"
	"github.com/hanwen/go-fuse/v2/fuse"
)

var ErrNotMounted = errors.New("not mounted")

// mount implements go-ipfs/fuse/mount.
type mount struct {
	mpoint string
	server *fuse.Server

	active     bool
	activeLock *sync.RWMutex

	unmountOnce sync.Once
}

// NewMount mounts a FUSE filesystem at a given location, and returns a Mount instance.
func NewMount(root fs.InodeEmbedder, mountpoint string, opts *fs.Options) (Mount, error) {
	PlatformMountOpts(&opts.MountOptions)
	if opts.RootStableAttr == nil {
		opts.RootStableAttr = &fs.StableAttr{Ino: RootIno}
	}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Check m.IsActive() before calling Unmount, or treat ErrNotMounted as success
  2. Use errors.Is(err, mount.ErrNotMounted) to filter it out of error handling
  3. If the mount should be active, check the FUSE server logs and /sys/fs/fuse connections for crashes
  4. Remount the directory with the normal mount command if it was externally unmounted

Example fix

// before
if err := target.Unmount(); err != nil {
    t.Fatal(err)
}
// after
if err := target.Unmount(); err != nil && !errors.Is(err, mount.ErrNotMounted) {
    t.Fatal(err)
}
Defensive patterns

Strategy: type-guard

Validate before calling

if m.IsActive() {
    err := m.Unmount()
}

Type guard

func isNotMounted(err error) bool { return errors.Is(err, mount.ErrNotMounted) }

Try / catch

if err := m.Unmount(); err != nil && !errors.Is(err, mount.ErrNotMounted) {
    return fmt.Errorf("unmount %s: %w", m.MountPoint(), err)
}

Prevention

When it happens

Trigger: Calling Unmount() on a mount that was already unmounted externally (e.g. user ran fusermount -u), never mounted, or whose server has exited (IsActive() == false).

Common situations: User manually unmounted the MFS/IPFS FUSE mount with fusermount, double-unmount during daemon shutdown, or the mount crashed and tests expect the sentinel.

Related errors


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