nats-io/nats-server · error
could not send control=%d: %v
Error message
could not send control=%d: %v
What it means
Windows ProcessSignal: sending the selected service control command via s.Control(cmd) returned an error — the service exists but rejected the control (e.g. service already stopping, permission issue, or SCM communication failure). The control code and error are echoed; the signal was not delivered.
Source
Thrown at server/signal_windows.go:94
case CommandStop, CommandQuit:
cmd = svc.Stop
to = svc.Stopped
case CommandReopen:
cmd = reopenLogCmd
to = svc.Running
case CommandReload:
cmd = svc.ParamChange
to = svc.Running
case commandLDMode:
cmd = ldmCmd
to = svc.Running
default:
return fmt.Errorf("unknown signal %q", command)
}
status, err := s.Control(cmd)
if err != nil {
return fmt.Errorf("could not send control=%d: %v", cmd, err)
}
timeout := time.Now().Add(10 * time.Second)
for status.State != to {
if timeout.Before(time.Now()) {
return fmt.Errorf("timeout waiting for service to go to state=%d", to)
}
time.Sleep(300 * time.Millisecond)
status, err = s.Query()
if err != nil {
return fmt.Errorf("could not retrieve service status: %v", err)
}
}
return nil
}
View on GitHub (pinned to 3a66a489d2)
Solutions
- Check service state with sc query before sending the control
- Run from an elevated shell to rule out access-denied
- Retry after the service reaches a stable state
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at server/signal_windows.go:94 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/7d84babb37d3e45c.
Report an issue: GitHub.