nats-io/nats-server · error
invalid pid: %s
Error message
invalid pid: %s
What it means
ProcessSignal validates the optional pid argument (after stripping a trailing '*' glob marker) and strconv failed to parse it as an integer PID. The offending string is echoed; it fires before any signal is sent, purely from CLI argument validation in nats-server --signal.
Source
Thrown at server/signal.go:105
// ProcessSignal sends the given signal command to the given process. If pidStr
// is empty, this will send the signal to the single running instance of
// nats-server. If multiple instances are running, pidStr can be a globular
// expression ending with '*'. This returns an error if the given process is
// not running or the command is invalid.
func ProcessSignal(command Command, pidExpr string) error {
var (
err error
errStr string
pids = make([]int, 1)
pidStr = strings.TrimSuffix(pidExpr, "*")
isGlob = strings.HasSuffix(pidExpr, "*")
)
// Validate input if given
if pidStr != "" {
if pids[0], err = strconv.Atoi(pidStr); err != nil {
return fmt.Errorf("invalid pid: %s", pidStr)
}
}
// Gather all PIDs unless the input is specific
if pidStr == "" || isGlob {
if pids, err = resolvePids(); err != nil {
return err
}
}
// Multiple instances are running and the input is not an expression
if len(pids) > 1 && !isGlob {
errStr = fmt.Sprintf("multiple %s processes running:", processName)
for _, p := range pids {
errStr += fmt.Sprintf("\n%d", p)
}
return errors.New(errStr)
}
// No instances are running
if len(pids) == 0 {View on GitHub (pinned to 3a66a489d2)
Solutions
- Pass a valid numeric pid, e.g. nats-server --signal <pid>:m
- Drop the pid to signal the single running instance
- Use a glob like '123*' only with digits before the '*'
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/signal.go:105 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/eddb5f928a99883a.
Report an issue: GitHub.