hashicorp/nomad · error
EventLogger is not supported on this platform
Error message
EventLogger is not supported on this platform
What it means
NewEventLogger on non-Windows platforms is a stub that always returns this error, because the Windows Event Log is only available on Windows. It exists so the API compiles cross-platform but fails fast if actually used elsewhere.
Source
Thrown at helper/winsvc/event_logger_nonwindows.go:16
// Copyright IBM Corp. 2015, 2026
// SPDX-License-Identifier: BUSL-1.1
//go:build !windows
package winsvc
import (
"errors"
"io"
)
// NewEventLogger is a stub for non-Windows platforms to generate
// and error when used.
func NewEventLogger(_ string) (io.WriteCloser, error) {
return nil, errors.New("EventLogger is not supported on this platform")
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Only call NewEventLogger on Windows (runtime.GOOS == "windows" build tag or runtime check)
- On non-Windows platforms use the standard log writer instead of an EventLogger
- If you see this unexpectedly, verify which binary/GOOS is actually running
- Route logger setup through a platform abstraction that picks the right implementation
Example fix
// before
w, err := winsvc.NewEventLogger("MyService")
// after
var w io.WriteCloser
if runtime.GOOS == "windows" {
w, err = winsvc.NewEventLogger("MyService")
} else {
w = os.Stdout // or another non-Windows writer
err = nil
} Defensive patterns
Strategy: fallback
Validate before calling
if runtime.GOOS != "windows" {
// do not call NewEventLogger; use standard writer
} Try / catch
w, err := winsvc.NewEventLogger("MyService")
if err != nil {
log.Printf("event logger unavailable (%v); falling back to stdout", err)
w = os.Stdout
} Prevention
- Build-tag or runtime.GOOS-gate all winsvc calls
- Use a platform abstraction for service logging
- Never assume EventLogger exists outside Windows binaries
- Test non-Windows builds before shipping portable code
When it happens
Trigger: Calling helper/winsvc.NewEventLogger(name) on Linux/macOS (any GOOS != windows); SetupLoggers invoking it on a non-Windows build.
Common situations: Portable code paths that unconditionally create an event logger regardless of OS; running a Windows-oriented service wrapper on Unix during development.
Related errors
- Windows path expansion not supported on this platform
- Windows directory creation not supported on this platform
- Windows service manager is not supported on this platform
- eventlog.level must be one of INFO, WARN, or ERROR
- failed to create fifo: %v
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/1d098092265031c1.
Report an issue: GitHub.