hashicorp/nomad · error
cannot open current nomad path for install - %s
Error message
cannot open current nomad path for install - %s
What it means
To install the binary without disturbing the running executable, binaryInstall opens the current nomad.exe with os.Open(exePath) so it can be copied. This error wraps os.Open failure — the source executable cannot be read. Note the destination is copied via a temp file that is later moved into place.
Source
Thrown at command/windows_service_install.go:337
// Build the needed paths
if opts.installDir == "" {
opts.installDir = winsvc.WINDOWS_INSTALL_BIN_DIRECTORY
}
opts.installDir, err = c.winPaths.Expand(opts.installDir)
if err != nil {
return fmt.Errorf("cannot generate binary install path - %s", err)
}
opts.binaryPath = filepath.Join(opts.installDir, "nomad.exe")
// Ensure the install directory exists
if err = c.winPaths.CreateDirectory(opts.installDir, false); err != nil {
return fmt.Errorf("could not create binary install directory - %s", err)
}
// Create a new copy of the current binary to install
exeFile, err := os.Open(exePath)
if err != nil {
return fmt.Errorf("cannot open current nomad path for install - %s", err)
}
defer exeFile.Close()
// Copy into a temporary file which can then be moved
// into the correct location.
dstFile, err := os.CreateTemp(os.TempDir(), "nomad*")
if err != nil {
return fmt.Errorf("cannot create copy - %s", err)
}
defer dstFile.Close()
if _, err = io.Copy(dstFile, exeFile); err != nil {
return fmt.Errorf("cannot write nomad binary for install - %s", err)
}
dstFile.Close()
// With a copy ready to be moved into place, ensure that
// the path is clear then move the file.View on GitHub (pinned to 482b49bf1a)
Solutions
- Verify the running nomad.exe still exists on disk (Get-Process nomad | Select Path)
- Re-extract a fresh nomad.exe and re-run the install from it
- Check file ACLs (icacls) and grant read access to the installing user
- Temporarily exclude nomad.exe from antivirus quarantine/real-time scanning
Example fix
// before: binary removed after launch // rename/delete nomad.exe while it runs, then: nomad windows service install // cannot open current nomad path // after: run from an intact binary C:\Ops\nomad\nomad.exe windows service install
Defensive patterns
Strategy: validation
Validate before calling
// Verify the source executable is readable before install
exePath, err := os.Executable()
if err != nil {
return fmt.Errorf("cannot resolve executable: %w", err)
}
f, err := os.Open(exePath)
if err != nil {
return fmt.Errorf("current nomad binary not readable: %w", err)
}
f.Close() Prevention
- Do not delete or replace nomad.exe while the installer runs
- Add antivirus exclusions for the Nomad binary to prevent quarantine
- Check ACLs (icacls) grant read access to the installing user
- Run the installer from a locally stored binary, not a network share
When it happens
Trigger: Running 'nomad windows service install' when os.Open(exePath) fails: the executable file was deleted/renamed after the process started, ACLs deny read access to it, or the path is invalid.
Common situations: Antivirus quarantining or deleting nomad.exe while running; replacing the binary mid-install; restrictive ACLs on the directory holding the running binary; network/UNC-hosted binary no longer accessible.
Related errors
- service registration check failed - %w
- unable to create service - %w
- cannot create configuration directory - %s
- cannot create data directory - %s
- could not create default configuration file - %s
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/1b2bf084a0afce00.
Report an issue: GitHub.