hashicorp/nomad · error
Windows service manager is not supported on this platform
Error message
Windows service manager is not supported on this platform
What it means
NewWindowsServiceManager on non-Windows platforms always returns this error; the Windows service control manager API only exists on Windows. The stub keeps the API surface compilable cross-platform while failing fast if invoked.
Source
Thrown at helper/winsvc/windows_service_nonwindows.go:14
// Copyright IBM Corp. 2015, 2026
// SPDX-License-Identifier: BUSL-1.1
//go:build !windows
package winsvc
import (
"errors"
)
// NewWindowsServiceManager returns an error
func NewWindowsServiceManager() (WindowsServiceManager, error) {
return nil, errors.New("Windows service manager is not supported on this platform")
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Only construct the manager on Windows (build tags or runtime.GOOS check)
- Skip Windows service management logic entirely on non-Windows platforms
- Handle the error by falling back to the platform's native service mechanism (systemd, launchd)
- Verify the running GOOS if this error appears unexpectedly
Example fix
// before
mgr, err := winsvc.NewWindowsServiceManager()
if err != nil { return err }
// after
if runtime.GOOS != "windows" {
return nil // not a Windows service context
}
mgr, err := winsvc.NewWindowsServiceManager() Defensive patterns
Strategy: fallback
Validate before calling
if runtime.GOOS != "windows" {
// skip Windows service manager entirely
return nil
} Try / catch
mgr, err := winsvc.NewWindowsServiceManager()
if err != nil {
// not on Windows: use systemd/launchd path or no-op
mgr = nil
} Prevention
- Only build/invoke Windows service management on windows GOOS
- Structure service lifecycle code per-platform
- Treat this error as a signal the wrong platform path executed
When it happens
Trigger: Calling helper/winsvc.NewWindowsServiceManager() on Linux/macOS (any build where the _nonwindows file is compiled).
Common situations: Agent startup code that installs/controls Windows services being run on Unix; portable binaries exercising Windows service management paths.
Related errors
- EventLogger is not supported on this platform
- Windows path expansion not supported on this platform
- Windows directory creation 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/74dd4dd162f843d1.
Report an issue: GitHub.