{"record":{"id":"977322ed1ce771c0","repo":"nats-io/nats-server","slug":"default-js-domain-contains-account-name-q-with-en","errorCode":null,"errorMessage":"default_js_domain contains account name %q with enabled JetStream","messagePattern":"default_js_domain contains account name %q with enabled JetStream","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/jetstream.go","lineNumber":2893,"sourceCode":"\t\t\tjs.mu.RUnlock()\n\t\t}\n\t}\n}\n\n// For validating options.\nfunc validateJetStreamOptions(o *Options) error {\n\t// in non operator mode, the account names need to be configured\n\tif len(o.JsAccDefaultDomain) > 0 {\n\t\tif len(o.TrustedOperators) == 0 {\n\t\t\tfor a, domain := range o.JsAccDefaultDomain {\n\t\t\t\tfound := false\n\t\t\t\tif isReservedAccount(a) {\n\t\t\t\t\tfound = true\n\t\t\t\t} else {\n\t\t\t\t\tfor _, acc := range o.Accounts {\n\t\t\t\t\t\tif a == acc.GetName() {\n\t\t\t\t\t\t\tif len(acc.jsLimits) > 0 && domain != _EMPTY_ {\n\t\t\t\t\t\t\t\treturn fmt.Errorf(\"default_js_domain contains account name %q with enabled JetStream\", a)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfound = true\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !found {\n\t\t\t\t\treturn fmt.Errorf(\"in non operator mode, `default_js_domain` references non existing account %q\", a)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor a := range o.JsAccDefaultDomain {\n\t\t\t\tif !nkeys.IsValidPublicAccountKey(a) {\n\t\t\t\t\treturn fmt.Errorf(\"default_js_domain contains account name %q, which is not a valid public account nkey\", a)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor a, d := range o.JsAccDefaultDomain {","sourceCodeStart":2875,"sourceCodeEnd":2911,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/jetstream.go#L2875-L2911","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove that account name from default_js_domain since its config already defines JetStream limits.","Or remove the inline jetstream limits from the account config and rely on the default domain.","Use account nkeys (not names) in default_js_domain for operator mode consistency.","Restart the server after fixing the config; this is a startup validation error."],"exampleFix":"// before\naccounts: { JSAPP: { jetstream: { max_memory: 1GiB } } }\ndefault_js_domain: \"JSAPP\"\n// after\naccounts: { JSAPP: { jetstream: { max_memory: 1GiB } } }\n# remove default_js_domain entry for JSAPP","handlingStrategy":"validation","validationCode":"// config-time check\nfor name := range cfg.DefaultJSDomain {\n    if acc := cfg.Accounts[name]; acc != nil && acc.JetStreamLimitsSet() {\n        return fmt.Errorf(\"account %s has jetstream limits; remove it from default_js_domain\", name)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never list a JetStream-enabled local account in default_js_domain","Keep domain mapping and inline jetstream limits mutually exclusive per account","Run `nats-server -t` in CI to catch startup validation errors","In operator mode, account domains come from JWTs - avoid duplicating them in server config"],"tags":["jetstream","configuration","domain","nats-server"],"backgroundTag":"jetstream-config-conflict","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}