{"record":{"id":"ef0bbaab64e9f14d","repo":"nats-io/nats-server","slug":"config-reload-not-supported-for-decreasing-jetstre","errorCode":null,"errorMessage":"config reload not supported for decreasing jetstream max memory and store","messagePattern":"config reload not supported for decreasing jetstream max memory and store","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/reload.go","lineNumber":1862,"sourceCode":"\t\t\t\t\t}\n\t\t\t\t\tif optName == \"jetstreammaxmemory\" {\n\t\t\t\t\t\tjsLimitsUpdate.newMaxMemory = new\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjsLimitsUpdate.newMaxStore = new\n\t\t\t\t\t}\n\t\t\t\tcase fromSet && toUnset:\n\t\t\t\t\t// Limits changed but it may mean that JS is being disabled,\n\t\t\t\t\t// keep track of the change and error in case it is not.\n\t\t\t\t\tif optName == \"jetstreammaxmemory\" {\n\t\t\t\t\t\tjsMemLimitsChanged = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjsFileLimitsChanged = true\n\t\t\t\t\t}\n\t\t\t\tcase fromUnset && toSet:\n\t\t\t\t\t// Prevent changing from dynamic max memory / file at runtime.\n\t\t\t\t\treturn nil, fmt.Errorf(\"config reload not supported for jetstream dynamic max memory and store\")\n\t\t\t\tdefault:\n\t\t\t\t\treturn nil, fmt.Errorf(\"config reload not supported for decreasing jetstream max memory and store\")\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"jetstreammetacompact\", \"jetstreammetacompactsize\", \"jetstreammetacompactsync\":\n\t\t\t// Allowed at runtime but monitorCluster looks at s.opts directly, so no further work needed here.\n\t\tcase \"jetstreamconcurrentios\":\n\t\t\t// Not reloadable at runtime; preserve the current value while JetStream is disabled,\n\t\t\t// e.g. the entire jetstream{} block was deleted.\n\t\t\tif newOpts.JetStream {\n\t\t\t\treturn nil, fmt.Errorf(\"config reload not supported for %s: old=%v, new=%v\",\n\t\t\t\t\tfield.Name, oldValue, newValue)\n\t\t\t} else {\n\t\t\t\tnewOpts.JetStreamConcurrentIOs = oldValue.(int)\n\t\t\t}\n\t\tcase \"websocket\":\n\t\t\t// Similar to gateways\n\t\t\ttmpOld := oldValue.(WebsocketOpts)\n\t\t\ttmpNew := newValue.(WebsocketOpts)\n\t\t\ttmpOld.TLSConfig, tmpOld.tlsConfigOpts = nil, nil","sourceCodeStart":1844,"sourceCodeEnd":1880,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/reload.go#L1844-L1880","documentation":"JetStream max_memory/max_store can only be increased via config reload, never decreased. When both old and new values are explicitly set and the new limit is lower than the running limit (the default branch of the switch), the server rejects the reload because shrinking live resource ceilings could strand in-use memory/storage.","triggerScenarios":"SIGHUP reload after lowering `jetstream.max_memory` or `jetstream.max_store` (e.g. from 4GB to 2GB) while JetStream is enabled and both old and new values are explicit.","commonSituations":"Freeing capacity on a busy node by editing the limits down and reloading; fleet-wide config pushes that reduce limits on some servers; mistaken unit edits (GB vs MB) that silently lower the value.","solutions":["Restart the server to apply a decreased limit","Increase the value instead of decreasing (increases are allowed at runtime)","Verify units in the config (e.g. \"2GB\" vs \"200MB\") — accidental unit mistakes trigger this error"],"exampleFix":"// before\njetstream { max_memory: 2GB }  # was 4GB, + reload signal\n// after\nserver # systemctl restart nats-server  (decreases require restart)\n// or increase instead:\njetstream { max_memory: 8GB }  # reload succeeds","handlingStrategy":"validation","validationCode":"// Only allow increases on reload:\nfunc limitDecreased(old, new *Options) bool {\n\treturn (new.MaxMemory > 0 && old.MaxMemory > 0 && new.MaxMemory < old.MaxMemory) ||\n\t\t(new.MaxStore > 0 && old.MaxStore > 0 && new.MaxStore < old.MaxStore)\n}\n// if limitDecreased(old, new) { scheduleRestart() }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["On reload, only ever raise jetstream.max_memory / max_store","Double-check units (GB vs MB) in generated configs","Plan restart windows for limit reductions"],"tags":["nats-server","config-reload","jetstream"],"backgroundTag":"jetstream-limit-reload-unsupported","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}