hashicorp/nomad · error
Windows path expansion not supported on this platform
Error message
Windows path expansion not supported on this platform
What it means
The non-Windows windowsPaths implementation of Expand always returns this error, since Windows-style environment/path expansion is meaningless off-Windows. It is a fail-fast stub for the cross-platform interface.
Source
Thrown at helper/winsvc/path_nonwindows.go:17
// Copyright IBM Corp. 2015, 2026
// SPDX-License-Identifier: BUSL-1.1
//go:build !windows
package winsvc
import "errors"
func NewWindowsPaths() WindowsPaths {
return &windowsPaths{}
}
type windowsPaths struct{}
func (w *windowsPaths) Expand(string) (string, error) {
return "", errors.New("Windows path expansion not supported on this platform")
}
func (w *windowsPaths) CreateDirectory(string, bool) error {
return errors.New("Windows directory creation not supported on this platform")
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Use the platform-appropriate Paths implementation; expansion is only valid on Windows
- Guard the call with runtime.GOOS == "windows" or a build-tagged abstraction
- Use os.ExpandEnv or filepath utilities for portable path expansion on Unix
- Confirm the process isn't mistakenly built to use windowsPaths on non-Windows
Example fix
// before
p, _ := winsvc.NewPaths() // windowsPaths on Linux
out, err := p.Expand("%APPDATA%\\svc")
// after
if runtime.GOOS != "windows" {
out = os.ExpandEnv("$HOME/.svc")
} else {
out, err = p.Expand("%APPDATA%\\svc")
} Defensive patterns
Strategy: fallback
Validate before calling
if runtime.GOOS != "windows" {
expanded := os.ExpandEnv(rawPath)
} Try / catch
out, err := paths.Expand(p)
if err != nil {
out = os.ExpandEnv(p) // portable fallback
} Prevention
- Gate winsvc path helpers behind GOOS checks or build tags
- Use os.ExpandEnv/filepath for cross-platform expansion
- Pick the correct Paths implementation per platform at startup
When it happens
Trigger: Calling windowsPaths.Expand(path) (via the Paths interface) on a non-Windows platform; code that uses the Windows path helpers compiled for Linux/macOS.
Common situations: Shared code that expands service paths without checking GOOS; running Windows service provisioning logic on Unix.
Related errors
- EventLogger is not supported on this platform
- Windows directory creation not supported on this platform
- Windows service manager is not supported on this platform
- failed to create fifo: %v
- failed to open fifo listener: %v
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/4f8b2a1805769ec7.
Report an issue: GitHub.