nats-io/nats-server · error

account %q not found

Error message

account %q not found

What it means

JszAccount validates that the requested account name exists in the server's account map and fails with this error when it doesn't. Unlike error 625, JetStream itself is enabled; only the account lookup fails.

Source

Thrown at server/monitor.go:3240

						sdet.DirectConsumer = append(sdet.DirectConsumer, cInfo)
					}
				}
			}
			detail.Streams = append(detail.Streams, sdet)
		}
	}
	return &detail
}

func (s *Server) JszAccount(opts *JSzOptions) (*AccountDetail, error) {
	js := s.getJetStream()
	if js == nil {
		return nil, fmt.Errorf("jetstream not enabled")
	}
	acc := opts.Account
	account, ok := s.accounts.Load(acc)
	if !ok {
		return nil, fmt.Errorf("account %q not found", acc)
	}
	js.mu.RLock()
	jsa, ok := js.accounts[account.(*Account).Name]
	js.mu.RUnlock()
	if !ok {
		return nil, fmt.Errorf("account %q not jetstream enabled", acc)
	}
	return s.accountDetail(jsa, opts.Streams, opts.Consumer, opts.DirectConsumer, opts.Config, opts.RaftGroups, opts.StreamLeaderOnly), nil
}

// helper to get cluster info from node via dummy group
func (s *Server) raftNodeToClusterInfo(node RaftNode) *ClusterInfo {
	if node == nil {
		return nil
	}
	peers := node.Peers()
	peerList := make([]string, len(peers))
	for i, p := range peers {

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Confirm the account name via /accountz or the server's config, then retry with the exact name
  2. Only request JszAccount for accounts active on the queried node
  3. On clusters, query the node where the account's clients/streams are located

Example fix

// before
detail, err := s.JszAccount(&server.JSzOptions{Account: "MISSING"})
// after
detail, err := s.JszAccount(&server.JSzOptions{Account: "EXISTING_ACC"})
Defensive patterns

Strategy: validation

Validate before calling

// confirm the account exists before JszAccount
az, err := srv.Accountz(&server.AccountzOptions{})
// then check az.Accounts for opts.Account before calling JszAccount

Try / catch

detail, err := srv.JszAccount(opts)
if err != nil && strings.Contains(err.Error(), "not found") {
	return nil, fmt.Errorf("account %q is not loaded on this server", opts.Account)
}

Prevention

When it happens

Trigger: Calling JszAccount with opts.Account set to a name not loaded on this server; hitting /jsz?acc=MISSING on a node where that account was never activated.

Common situations: Monitoring dashboards iterating over accounts defined in a central config not yet propagated to all servers; typos in account names; clustered deployments where the account only exists on other nodes.

Related errors


AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02). Data as JSON: /api/errors/7e774dc56f2c2fa4. Report an issue: GitHub.