hashicorp/nomad · error
Windows directory creation not supported on this platform
Error message
Windows directory creation not supported on this platform
What it means
The non-Windows windowsPaths implementation of CreateDirectory always returns this error; directory creation via the Windows service path helper is unsupported off-Windows. Fail-fast stub for the cross-platform interface.
Source
Thrown at helper/winsvc/path_nonwindows.go:21
//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 os.MkdirAll on non-Windows platforms instead of the winsvc helper
- Guard directory creation with a runtime.GOOS or build-tag check
- Route setup through a platform abstraction that picks the correct implementation
- Verify which Paths implementation the running binary uses
Example fix
// before
err := paths.CreateDirectory(dir, true)
// after
if runtime.GOOS == "windows" {
err = paths.CreateDirectory(dir, true)
} else {
err = os.MkdirAll(dir, 0o755)
} Defensive patterns
Strategy: fallback
Validate before calling
if runtime.GOOS != "windows" {
err := os.MkdirAll(dir, 0o755)
} Try / catch
err := paths.CreateDirectory(dir, true)
if err != nil {
err = os.MkdirAll(dir, 0o755) // portable fallback
} Prevention
- Use os.MkdirAll directly on non-Windows platforms
- Abstract directory setup behind a per-platform implementation
- GOOS-gate all winsvc filesystem helpers
When it happens
Trigger: Calling windowsPaths.CreateDirectory(path, ...) via the Paths interface on Linux/macOS.
Common situations: Service setup code creating working directories regardless of OS; running Windows service install logic on Unix.
Related errors
- EventLogger is not supported on this platform
- Windows path expansion not supported on this platform
- Windows service manager is not supported on this platform
- cannot create copy - %s
- cannot write nomad binary for install - %s
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/a6479bbdeb4ef30d.
Report an issue: GitHub.