hashicorp/nomad · warning

could not remove eventlog configuration

Error message

could not remove eventlog configuration - %w

What it means

performUninstall wraps the error from srvc.DisableEventlog(), which removes the Nomad service's event-log registration so stale entries do not remain after deletion. Failure means the event-log registry configuration could not be updated, though the service itself has already been stopped.

Solutions

  1. Run the uninstall from an elevated Administrator prompt
  2. Check the wrapped error for a registry access-denied code and inspect the EventLog key ACLs
  3. Delete the eventlog registry key manually (reg delete) and re-run uninstall
  4. Restart the Windows Event Log service if it holds the key

Example fix

// manual cleanup alternative
reg delete HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\nomad /f
Defensive patterns

Strategy: fallback

Try / catch

if err := uninstallCmd.Run(); err != nil {
    if strings.Contains(err.Error(), "eventlog configuration") {
        // fall back to manual registry cleanup:
        exec.Command("reg", "delete", `HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\nomad`, "/f")
    }
}

Prevention

When it happens

Trigger: DisableEventlog fails because the HKLM\SYSTEM\CurrentControlSet\Services\...\EventLog registry key is locked or access is denied, or the process is not elevated while performUninstall cleans up the eventlog entry.

Common situations: Registry ACLs restrict the uninstaller's account; eventlog key held by Event Log service or monitoring software; non-admin run.

Related errors


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

Appendix: source

Thrown at command/windows_service_uninstall.go:112

	if !exists {
		return nil
	}

	// Grab the service and ensure the service is stopped
	srvc, err := m.GetService(winsvc.WINDOWS_SERVICE_NAME)
	if err != nil {
		return fmt.Errorf("could not get existing service - %w", err)
	}
	defer srvc.Close()

	if err := srvc.Stop(); err != nil {
		return fmt.Errorf("unable to stop service - %w", err)
	}

	// Remove the service from the event log
	if err := srvc.DisableEventlog(); err != nil {
		return fmt.Errorf("could not remove eventlog configuration - %w", err)
	}

	// Finally, delete the service
	if err := srvc.Delete(); err != nil {
		return fmt.Errorf("could not delete service - %w", err)
	}

	return nil
}

View on GitHub (pinned to 482b49bf1a)