nats-io/nats-server · error

Error enabling jetstream on configured accounts: %v

Error message

Error enabling jetstream on configured accounts: %v

What it means

When no single account is targeted, enableJetStreamDomain/configure path calls configAllJetStreamAccounts to enable JetStream on every account configured with jetstream enable. A wrapped failure there is reported with this message, indicating one or more configured accounts could not be set up for JetStream.

Source

Thrown at server/jetstream.go:787

func (s *Server) enableJetStreamAccounts() error {
	// Reuse the same task workers across all accounts, so that we don't explode
	// with a large number of goroutines on multi-account systems.
	tq := parallelTaskQueue(min(64, s.diskIOSemaphore().cap()))
	defer close(tq)

	// If we have no configured accounts setup then setup imports on global account.
	if s.globalAccountOnly() {
		gacc := s.GlobalAccount()
		gacc.mu.Lock()
		if len(gacc.jsLimits) == 0 {
			gacc.jsLimits = defaultJSAccountTiers
		}
		gacc.mu.Unlock()
		if err := s.configJetStream(gacc, tq); err != nil {
			return err
		}
	} else if err := s.configAllJetStreamAccounts(tq); err != nil {
		return fmt.Errorf("Error enabling jetstream on configured accounts: %v", err)
	}
	return nil
}

// enableAllJetStreamServiceImportsAndMappings turns on all service imports and mappings for jetstream for this account.
func (a *Account) enableAllJetStreamServiceImportsAndMappings() error {
	a.mu.RLock()
	s := a.srv
	a.mu.RUnlock()

	if s == nil {
		return fmt.Errorf("jetstream account not registered")
	}

	var dstAccName string
	if sacc := s.SystemAccount(); sacc != nil {
		dstAccName = sacc.Name
	}

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Read the wrapped %v cause in the log and fix the specific account's config first
  2. Verify every account marked jetstream enable exists in the resolver and its limits are valid
  3. Simplify: enable JetStream per-account incrementally to isolate the failing account
  4. Check cluster propagation of account config (resolver, nats account server) is healthy

Example fix

// before
accounts { A { jetstream: enable, users: [a] } B { jetstream: enable } } // B invalid limits
// after
accounts {
  A { jetstream: { max_file: 1Gi, max_mem: 256Mi }, users: [a] }
  B { jetstream: { max_file: 1Gi, max_mem: 256Mi }, users: [b] }
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate every account with jetstream enabled before server start:
// - account exists in resolver
// - jetstream block has valid limits (max_file/max_mem, streams)
// nats account info <acct> --server <url>  # resolver sanity check

Prevention

When it happens

Trigger: Server-level JetStream enable where per-account config (accounts { ... jetstream: enable }) fails during configAllJetStreamAccounts — e.g. an account's stream/template setup or service import wiring fails.

Common situations: Typo'd or invalid per-account jetstream config; account not found in resolver; max stream/consumer limits preventing setup; mixed cluster where account update to followers fails.

Related errors


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