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

  1. Only call NewEventLogger on Windows (runtime.GOOS == "windows" build tag or runtime check)
  2. On non-Windows platforms use the standard log writer instead of an EventLogger
  3. If you see this unexpectedly, verify which binary/GOOS is actually running
  4. 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

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


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