nats-io/nats-server · error
Account %s does not exist
Error message
Account %s does not exist
What it means
accountInfo looks up the account by name in the server's account map and returns this error when no account with that name exists. It backs the /accountz monitoring endpoint (and JszAccount paths) for a named account.
Source
Thrown at server/monitor.go:2847
Type: jwt.Service,
// Deprecated so we duplicate. Use LocalSubject.
To: jwt.Subject(v.from),
LocalSubject: jwt.RenamingSubject(v.from),
}
imp.TrackingHdr = v.trackingHdr
imp.Latency = newExtServiceLatency(v.latency)
if v.m1 != nil {
m1 := *v.m1
imp.M1 = &m1
}
}
return imp
}
func (s *Server) accountInfo(accName string) (*AccountInfo, error) {
var a *Account
if v, ok := s.accounts.Load(accName); !ok {
return nil, fmt.Errorf("Account %s does not exist", accName)
} else {
a = v.(*Account)
}
isSys := a == s.SystemAccount()
a.mu.RLock()
defer a.mu.RUnlock()
var vrIssues []ExtVrIssues
claim, _ := jwt.DecodeAccountClaims(a.claimJWT) // ignore error
if claim != nil {
vr := jwt.ValidationResults{}
claim.Validate(&vr)
vrIssues = make([]ExtVrIssues, len(vr.Issues))
for i, v := range vr.Issues {
vrIssues[i] = ExtVrIssues{v.Description, v.Blocking, v.TimeCheck}
}
}
collectRevocations := func(revocations map[string]int64) map[string]time.Time {
l := len(revocations)View on GitHub (pinned to 3a66a489d2)
Solutions
- Verify the account name matches an account defined in the server's configuration or resolvable via the resolver
- Use /accountz without the acc parameter to list all accounts and confirm the correct name
- Ensure the account has been used/activated on this node (e.g. a client connected) before querying by name in clustered setups
Example fix
// before GET /accountz?acc=OLD_NAME -> 404-style error // after GET /accountz // list accounts first GET /accountz?acc=CURRENT_NAME
Defensive patterns
Strategy: try-catch
Validate before calling
var accounts []server.Accountz
// fetch /accountz first and confirm the name exists before querying by acc=
func accountExists(list *server.Accountz, name string) bool {
for _, a := range list.Accounts {
if a.Account.Name == name {
return true
}
}
return false
} Try / catch
info, err := srv.Accountz(&server.AccountzOptions{Account: name})
if err != nil && strings.Contains(err.Error(), "does not exist") {
// fall back to listing all accounts
} Prevention
- Discover account names via /accountz instead of hardcoding them
- In clusters, check whether the account is active on the queried node
- Keep monitoring tooling in sync with account renames in config
When it happens
Trigger: Requesting /accountz?acc=NAME for an account not loaded on this server; calling accountInfo/Accountz with a mistyped account name or one that exists only on other cluster members.
Common situations: Monitoring dashboards tracking accounts from a config file that hasn't been applied to this server; querying a specific node in a cluster where the account hasn't been activated yet (accounts materialize on demand); renaming accounts in config without updating tooling.
Related errors
- account %q not found
- fetching jwt failed due to shutdown
- fetching jwt timed out
- gsl: no matches found
- subject %q is malformed
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/12cfe9c40c8476e1.
Report an issue: GitHub.