hashicorp/nomad · error
service registration check failed - %w
Error message
service registration check failed - %w
What it means
Wraps a failure from `IsServiceRegistered(WINDOWS_SERVICE_NAME)` on the Windows service manager. Before creating or updating the service, install queries the SCM for whether 'Nomad' exists; if that query itself errors, install aborts with this message.
Source
Thrown at command/windows_service_install.go:195
c.Ui.Output(fmt.Sprintf(" Nomad configuration directory: %s", opts.configDir))
c.Ui.Output(fmt.Sprintf(" Nomad agent data directory: %s", opts.configDir))
// Now let's install that service
if err := c.serviceInstall(m, opts); err != nil {
return fmt.Errorf("service install failed - %w", err)
}
return nil
}
func (c *WindowsServiceInstallCommand) serviceInstall(m winsvc.WindowsServiceManager, opts *windowsInstallOpts) error {
var err error
var srvc winsvc.WindowsService
cmd := fmt.Sprintf("%s agent -config %s", opts.binaryPath, opts.configDir)
exists, err := m.IsServiceRegistered(winsvc.WINDOWS_SERVICE_NAME)
if err != nil {
return fmt.Errorf("service registration check failed - %w", err)
}
// If the service already exists, open it and update. Otherwise
// create a new service.
if exists {
srvc, err = m.GetService(winsvc.WINDOWS_SERVICE_NAME)
if err != nil {
return fmt.Errorf("unable to get existing service - %w", err)
}
defer srvc.Close()
if err := srvc.Configure(winsvc.WindowsServiceConfiguration{
StartType: winsvc.StartAutomatic,
DisplayName: winsvc.WINDOWS_SERVICE_DISPLAY_NAME,
Description: winsvc.WINDOWS_SERVICE_DESCRIPTION,
BinaryPathName: cmd,
}); err != nil {
return fmt.Errorf("unable to configure service - %w", err)
}View on GitHub (pinned to 482b49bf1a)
Solutions
- Re-run the command from an elevated (Run as Administrator) shell
- Verify the SCM is healthy: `sc query nomad` from an admin prompt
- Reboot the host if SCM/RPC is in a bad state after updates
- Check antivirus/security software blocking SCM queries
Example fix
// before PS> nomad windows install // after PS (admin)> nomad windows install
Defensive patterns
Strategy: try-catch
Validate before calling
out, err := exec.Command("sc.exe", "query", "nomad").CombinedOutput()
if err != nil && !strings.Contains(string(out), "1060") {
log.Fatalf("SCM query failed unexpectedly: %v\n%s", err, out)
} Try / catch
exists, err := m.IsServiceRegistered(winsvc.WINDOWS_SERVICE_NAME)
if err != nil {
if errors.Is(err, windows.ERROR_ACCESS_DENIED) { /* elevate and retry */ }
return fmt.Errorf("service registration check failed - %w", err)
} Prevention
- Always install from an elevated shell
- Confirm SCM health with `sc query nomad` beforehand
- Reboot after Windows updates if SCM RPC errors appear
When it happens
Trigger: Opening the SCM database or querying service 'Nomad' fails — typically ERROR_ACCESS_DENIED when not elevated, or SCM RPC failure.
Common situations: Running the install command in a non-elevated shell; broken Windows management instrumentation/SCM after updates; remote-registry restrictions.
Related errors
- unable to create service - %w
- unable to check for existing service - %w
- could not get existing service - %w
- unable to stop existing service - %w
- service install failed - %w
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/f265a5b42b221188.
Report an issue: GitHub.