nats-io/nats-server · error

default_js_domain contains account name %q with enabled JetS

Error message

default_js_domain contains account name %q with enabled JetStream

What it means

In non-operator mode, DefaultJSDomain is only meaningful for reserved/system accounts that internally have JetStream enabled. During option validation the server scans configured accounts; if an account name listed in default_js_domain (JsAccDefaultDomain) has JetStream limits enabled in its config and is not a reserved account, the mapping is ambiguous/rejected and this error is returned at server startup.

Source

Thrown at server/jetstream.go:2893

			js.mu.RUnlock()
		}
	}
}

// For validating options.
func validateJetStreamOptions(o *Options) error {
	// in non operator mode, the account names need to be configured
	if len(o.JsAccDefaultDomain) > 0 {
		if len(o.TrustedOperators) == 0 {
			for a, domain := range o.JsAccDefaultDomain {
				found := false
				if isReservedAccount(a) {
					found = true
				} else {
					for _, acc := range o.Accounts {
						if a == acc.GetName() {
							if len(acc.jsLimits) > 0 && domain != _EMPTY_ {
								return fmt.Errorf("default_js_domain contains account name %q with enabled JetStream", a)
							}
							found = true
							break
						}
					}
				}
				if !found {
					return fmt.Errorf("in non operator mode, `default_js_domain` references non existing account %q", a)
				}
			}
		} else {
			for a := range o.JsAccDefaultDomain {
				if !nkeys.IsValidPublicAccountKey(a) {
					return fmt.Errorf("default_js_domain contains account name %q, which is not a valid public account nkey", a)
				}
			}
		}
		for a, d := range o.JsAccDefaultDomain {

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Remove that account name from default_js_domain since its config already defines JetStream limits.
  2. Or remove the inline jetstream limits from the account config and rely on the default domain.
  3. Use account nkeys (not names) in default_js_domain for operator mode consistency.
  4. Restart the server after fixing the config; this is a startup validation error.

Example fix

// before
accounts: { JSAPP: { jetstream: { max_memory: 1GiB } } }
default_js_domain: "JSAPP"
// after
accounts: { JSAPP: { jetstream: { max_memory: 1GiB } } }
# remove default_js_domain entry for JSAPP
Defensive patterns

Strategy: validation

Validate before calling

// config-time check
for name := range cfg.DefaultJSDomain {
    if acc := cfg.Accounts[name]; acc != nil && acc.JetStreamLimitsSet() {
        return fmt.Errorf("account %s has jetstream limits; remove it from default_js_domain", name)
    }
}

Prevention

When it happens

Trigger: Config where an entry in default_js_domain names a locally configured account whose config has jetstream limits enabled (acc.jsLimits > 0) with a non-empty domain - the server refuses the default-domain mapping because the account already has its own JetStream domain settings.

Common situations: Mixing per-account 'jetstream: {..}' config blocks with a global default_js_domain pointing at the same account; copy-pasted config adding an account name to default_js_domain that already has JetStream enabled; operator-mode configs ported to non-operator mode.

Related errors


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