nats-io/nats-server · warning

account %q not jetstream enabled

Error message

account %q not jetstream enabled

What it means

The account exists but has no JetStream account entry (it has never used JetStream, e.g. no streams/consumers and no template initialized), so JszAccount cannot produce an account detail and returns this error.

Source

Thrown at server/monitor.go:3246

	}
	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 {
		peerList[i] = p.ID
	}
	group := &raftGroup{
		Name:  _EMPTY_,
		Peers: peerList,
		node:  node,

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Only query JszAccount for accounts that have used JetStream (have streams/consumers)
  2. Treat this error as 'no JetStream data for this account' and render an empty panel
  3. Initialize JetStream usage for the account (create a stream) if it should be JetStream-enabled

Example fix

// before
info, err := s.JszAccount(&server.JSzOptions{Account: "PLAIN_ACC"}) // err: not jetstream enabled
// after
info, err := s.JszAccount(&server.JSzOptions{Account: "JS_ACC"})
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check: call JszAccount without Account (server-level JSz) and see if the account appears in Accounts list

Try / catch

detail, err := srv.JszAccount(opts)
if err != nil && strings.Contains(err.Error(), "not jetstream enabled") {
	return nil, nil // account exists but has no JetStream usage
}

Prevention

When it happens

Trigger: Calling JszAccount with opts.Account naming a valid account that has not touched JetStream; querying /jsz?acc=NAME for an account created but never used with JetStream APIs.

Common situations: Dashboards enumerating all accounts and assuming every one is JetStream-enabled; freshly created accounts before first JetStream usage; accounts on servers where JetStream is enabled only for specific accounts.

Related errors


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