hashicorp/nomad · error
binary install failed - %w
Error message
binary install failed - %w
What it means
Wraps the failure of `binaryInstall`, which copies the Nomad binary to the target install path during `windows install`. Any filesystem error (missing source binary, permission denied, target locked) is surfaced here with %w.
Source
Thrown at command/windows_service_install.go:165
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
// a basic configuration file if no configuration
// currently exists
if err = c.configInstall(opts); err != nil {
return fmt.Errorf("configuration install failed - %w", err)
}
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)
}View on GitHub (pinned to 482b49bf1a)
Solutions
- Ensure the Nomad service is stopped (`sc query nomad` shows STOPPED) before installing
- Run the command from an elevated shell
- Check write permission / free disk space on the target directory
- Add an antivirus exclusion for the Nomad install path and retry
Example fix
// before nomad windows install // after sc.exe stop nomad; nomad windows install -reinstall
Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Stat(opts.binaryPath); err == nil {
if f, e := os.OpenFile(opts.binaryPath, os.O_RDWR, 0o644); e != nil {
log.Fatalf("target binary locked or unwritable: %v", e)
} else { f.Close() }
} Try / catch
if err := c.binaryInstall(opts); err != nil {
if errors.Is(err, os.ErrPermission) { /* retry elevated */ }
return fmt.Errorf("binary install failed - %w", err)
} Prevention
- Stop the Nomad service before replacing its binary
- Check disk space and directory ACLs on the install path
- Run from an elevated shell
- Exclude the install path from antivirus scanning
When it happens
Trigger: The running executable or source binary cannot be copied to opts.binaryPath: destination file locked by the running service, insufficient privileges, or source path missing.
Common situations: Target binary in use because the service wasn't fully stopped; installing into a protected directory without elevation; AV software quarantining the copy.
Related errors
- Windows directory creation not supported on this platform
- failed to determine absolute path for %s
- failed to get free disk space for %s: %v
- unable to stop existing service - %w
- configuration install failed - %w
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/68e9a01e272c32e9.
Report an issue: GitHub.