{"record":{"id":"d0ca96e6035ffccf","repo":"nats-io/nats-server","slug":"error-enabling-jetstream-on-configured-accounts","errorCode":null,"errorMessage":"Error enabling jetstream on configured accounts: %v","messagePattern":"Error enabling jetstream on configured accounts: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/jetstream.go","lineNumber":787,"sourceCode":"func (s *Server) enableJetStreamAccounts() error {\n\t// Reuse the same task workers across all accounts, so that we don't explode\n\t// with a large number of goroutines on multi-account systems.\n\ttq := parallelTaskQueue(min(64, s.diskIOSemaphore().cap()))\n\tdefer close(tq)\n\n\t// If we have no configured accounts setup then setup imports on global account.\n\tif s.globalAccountOnly() {\n\t\tgacc := s.GlobalAccount()\n\t\tgacc.mu.Lock()\n\t\tif len(gacc.jsLimits) == 0 {\n\t\t\tgacc.jsLimits = defaultJSAccountTiers\n\t\t}\n\t\tgacc.mu.Unlock()\n\t\tif err := s.configJetStream(gacc, tq); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else if err := s.configAllJetStreamAccounts(tq); err != nil {\n\t\treturn fmt.Errorf(\"Error enabling jetstream on configured accounts: %v\", err)\n\t}\n\treturn nil\n}\n\n// enableAllJetStreamServiceImportsAndMappings turns on all service imports and mappings for jetstream for this account.\nfunc (a *Account) enableAllJetStreamServiceImportsAndMappings() error {\n\ta.mu.RLock()\n\ts := a.srv\n\ta.mu.RUnlock()\n\n\tif s == nil {\n\t\treturn fmt.Errorf(\"jetstream account not registered\")\n\t}\n\n\tvar dstAccName string\n\tif sacc := s.SystemAccount(); sacc != nil {\n\t\tdstAccName = sacc.Name\n\t}","sourceCodeStart":769,"sourceCodeEnd":805,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/jetstream.go#L769-L805","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the wrapped %v cause in the log and fix the specific account's config first","Verify every account marked jetstream enable exists in the resolver and its limits are valid","Simplify: enable JetStream per-account incrementally to isolate the failing account","Check cluster propagation of account config (resolver, nats account server) is healthy"],"exampleFix":"// before\naccounts { A { jetstream: enable, users: [a] } B { jetstream: enable } } // B invalid limits\n// after\naccounts {\n  A { jetstream: { max_file: 1Gi, max_mem: 256Mi }, users: [a] }\n  B { jetstream: { max_file: 1Gi, max_mem: 256Mi }, users: [b] }\n}","handlingStrategy":"validation","validationCode":"// Validate every account with jetstream enabled before server start:\n// - account exists in resolver\n// - jetstream block has valid limits (max_file/max_mem, streams)\n// nats account info <acct> --server <url>  # resolver sanity check","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate account configs (schema/lint) in CI before rollout","Enable JetStream per-account incrementally to isolate bad configs","Keep resolver / account server healthy and monitored","Read the wrapped cause in the log; it names the account that failed"],"tags":["jetstream","accounts","configuration","startup"],"backgroundTag":"jetstream-account-enable-failed","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}