hashicorp/nomad · error

Unsupported platform

Error message

Unsupported platform

What it means

On platforms without mount support (the build-tag-gated mount_unsupported.go stub), the mounter stub returns this error from every method. IsNotAMountPoint cannot check mount status on an unsupported OS, so it always fails with "Unsupported platform".

Source

Thrown at helper/mount/mount_unsupported.go:24

package mount

import (
	"errors"
)

// mounter provides the default implementation of mount.Mounter
// for unsupported platforms.
type mounter struct {
}

// New returns a Mounter for the current system.
func New() Mounter {
	return &mounter{}
}

func (m *mounter) IsNotAMountPoint(path string) (bool, error) {
	return false, errors.New("Unsupported platform")
}

func (m *mounter) Mount(device, target, mountType, options string) error {
	return errors.New("Unsupported platform")
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Run on a supported platform (Linux/BSD) where the real mounter implementation is compiled in.
  2. Guard call sites with runtime.GOOS checks and skip mount inspection on unsupported OSes.
  3. If platform support is needed, provide a concrete Mounter implementation with the appropriate build tags instead of relying on the stub.

Example fix

// before
isMount, err := m.IsNotAMountPoint(path)
// after
if runtime.GOOS == "windows" {
    return nil // mount inspection unsupported on this platform
}
isMount, err := m.IsNotAMountPoint(path)
Defensive patterns

Strategy: fallback

Validate before calling

if runtime.GOOS != "linux" && runtime.GOOS != "darwin" && !isBSD(runtime.GOOS) {
    // mount inspection unavailable; skip
}

Type guard

func mountSupported() bool {
    switch runtime.GOOS {
    case "linux", "darwin", "freebsd", "openbsd", "netbsd":
        return true
    }
    return false
}

Try / catch

isMount, err := m.IsNotAMountPoint(path)
if err != nil && err.Error() == "Unsupported platform" {
    // degrade: treat as unknown, skip mount check
    return unknownMountState, nil
}

Prevention

When it happens

Trigger: Calling mount.New().IsNotAMountPoint(path) on a build compiled for an unsupported platform (e.g. the file has no OS build tag coverage — typically Windows or other non-Linux/BSD targets), or when the helper/raftutil code inspects raft bolt files on such a platform.

Common situations: Cross-compiling Nomad helpers for Windows/unsupported OS; unit tests of mount-dependent code running on an OS excluded by build tags; code assuming Linux-only features while running on macOS/Windows builds of the stub.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/394559caf0a62148. Report an issue: GitHub.