nats-io/nats-server · error
could not access service: %v
Error message
could not access service: %v
What it means
Windows ProcessSignal: the Windows service manager (mgr.Connect succeeded) but OpenService failed for the named service (default 'nats-server'), so the service does not exist or the user lacks access. The underlying mgr error is appended; this is the Windows equivalent of a signal target not found.
Source
Thrown at server/signal_windows.go:66
}
// ProcessSignal sends the given signal command to the running nats-server service.
// If service is empty, this signals the "nats-server" service. This returns an
// error is the given service is not running or the command is invalid.
func ProcessSignal(command Command, service string) error {
if service == "" {
service = serviceName
}
m, err := mgr.Connect()
if err != nil {
return err
}
defer m.Disconnect()
s, err := m.OpenService(service)
if err != nil {
return fmt.Errorf("could not access service: %v", err)
}
defer s.Close()
var (
cmd svc.Cmd
to svc.State
)
switch command {
case CommandStop, CommandQuit:
cmd = svc.Stop
to = svc.Stopped
case CommandReopen:
cmd = reopenLogCmd
to = svc.Running
case CommandReload:
cmd = svc.ParamChange
to = svc.RunningView on GitHub (pinned to 3a66a489d2)
Solutions
- Verify the service exists: sc query nats-server (or the name you passed)
- Run the command from an elevated/authorized shell
- Install the service first (nats-server --service install) or pass the correct service name
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/signal_windows.go:66 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/5591a345ba377b65.
Report an issue: GitHub.