nats-io/nats-server · error

jetstream not enabled

Error message

jetstream not enabled

What it means

JszAccount returns this when the server has no JetStream service (getJetStream() returns nil), i.e. JetStream was not enabled on this server via configuration. There is no JetStream account data to report.

Source

Thrown at server/monitor.go:3235

							continue
						}
						if !optCfg {
							cInfo.Config = nil
						}
						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 {

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Enable JetStream in the server config: add jetstream { store_dir: "/path" } and restart
  2. Route jsz monitoring requests only to servers known to have JetStream enabled (check /varz or ServerID against your deployment inventory)
  3. Handle the error as 'feature unavailable' and skip JetStream panels for this node

Example fix

// before (nats-server.conf)
// no jetstream block
// after
jetstream {
  store_dir: "/data/nats"
}
Defensive patterns

Strategy: fallback

Validate before calling

// check via varz whether jetstream is enabled before calling JszAccount
func jetstreamEnabled(v *server.Varz) bool { return v.Config != nil && v.Config.JetStream }
// or via /jsz on the server root returning 404/error when disabled

Try / catch

detail, err := srv.JszAccount(opts)
if err != nil && err.Error() == "jetstream not enabled" {
	return nil, nil // feature unavailable on this node
}

Prevention

When it happens

Trigger: Calling JszAccount (or hitting /jsz?acc=NAME) on a server whose config lacks the jetstream {} block; calling it before JetStream initialization on a server where it is conditionally enabled.

Common situations: Uniform monitoring tooling pointed at a mixed cluster where some nodes run without JetStream; after removing the jetstream config block to disable it; default-config servers that never enabled JetStream.

Related errors


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