nats-io/nats-server · error
config required
Error message
config required
What it means
Guard inside newMemStoreWithMode: the StreamConfig pointer passed to create a JetStream memory store is nil, so the store cannot determine retention, limits, or subject filters. Callers are newMemStore and setupStore, so this indicates a stream being created without a config.
Source
Thrown at server/memstore.go:64
ageChk *time.Timer // Timer to expire messages.
ageChkRun bool // Whether message expiration is currently running.
ageChkTime int64 // When the message expiration is scheduled to run.
recovering bool // Timers, schedules, TTLs etc won't fire while set.
consumers []ConsumerStore
receivedAny bool
ttls *thw.HashWheel
scheduling *MsgScheduling
sdm *SDMMeta
sources map[string]*StreamSourceState
}
func newMemStore(cfg *StreamConfig) (*memStore, error) {
return newMemStoreWithMode(cfg, false)
}
func newMemStoreWithMode(cfg *StreamConfig, recovering bool) (*memStore, error) {
if cfg == nil {
return nil, fmt.Errorf("config required")
}
if cfg.Storage != MemoryStorage {
return nil, fmt.Errorf("memStore requires memory storage type in config")
}
ms := &memStore{
msgs: make(map[uint64]*StoreMsg),
fss: stree.NewSubjectTree[SimpleState](),
maxp: cfg.MaxMsgsPer,
cfg: *cfg,
recovering: recovering,
}
// Only create a THW if we're going to allow TTLs.
if cfg.AllowMsgTTL {
ms.ttls = thw.NewHashWheel()
}
if cfg.AllowMsgSchedules {
ms.scheduling = newMsgScheduling(ms.runMsgScheduling)
ms.scheduling.paused = recoveringView on GitHub (pinned to 3a66a489d2)
Solutions
- Ensure StreamConfig is fully populated before calling newMemStore/setupStore
- Validate stream creation requests at the API layer so a nil config never reaches the store constructor
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/memstore.go:64 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/254301aa7178f84a.
Report an issue: GitHub.