hashicorp/nomad · error

service is already running. Please run the command again wit

Error message

service is already running. Please run the
command again with -reinstall to stop the service and install.

What it means

Deliberate guard in performInstall: the existing Nomad Windows service is currently running and -reinstall was not supplied, so the install refuses to stop/replace a live service; the operator must opt in.

Source

Thrown at command/windows_service_install.go:152

	exists, err := m.IsServiceRegistered(winsvc.WINDOWS_SERVICE_NAME)
	if err != nil {
		return fmt.Errorf("unable to check for existing service - %w", err)
	}

	if exists {
		nmdSvc, err := m.GetService(winsvc.WINDOWS_SERVICE_NAME)
		if err != nil {
			return fmt.Errorf("could not get existing service to stop - %w", err)
		}

		// If the service is running and the reinstall
		// option was not set, return an error
		running, err := nmdSvc.IsRunning()
		if err != nil {
			return fmt.Errorf("unable to determine service state - %w", err)
		}
		if running && !opts.reinstall {
			return fmt.Errorf("service is already running. Please run the\ncommand again with -reinstall to stop the service and install.")
		}

		if running {
			c.Ui.Output("  Stopping existing nomad service")
			if err := nmdSvc.Stop(); err != nil {
				return fmt.Errorf("unable to stop existing service - %w", err)
			}
		}
	}

	// Install the nomad binary into the system
	if err = c.binaryInstall(opts); err != nil {
		return fmt.Errorf("binary install failed - %w", err)
	}

	c.Ui.Output(fmt.Sprintf("  Nomad binary installed to: %s", opts.binaryPath))

	// Create a configuration directory and add

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Re-run the install command with -reinstall to stop and replace the running service
  2. Or stop the service manually (sc stop / services.msc) before installing
  3. Schedule the reinstall during a maintenance window to avoid agent downtime
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at command/windows_service_install.go:152 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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