{"record":{"id":"9ae4304c0db405ec","repo":"nats-io/nats-server","slug":"memstore-requires-memory-storage-type-in-config","errorCode":null,"errorMessage":"memStore requires memory storage type in config","messagePattern":"memStore requires memory storage type in config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/memstore.go","lineNumber":67,"sourceCode":"\trecovering  bool        // Timers, schedules, TTLs etc won't fire while set.\n\tconsumers   []ConsumerStore\n\treceivedAny bool\n\tttls        *thw.HashWheel\n\tscheduling  *MsgScheduling\n\tsdm         *SDMMeta\n\tsources     map[string]*StreamSourceState\n}\n\nfunc newMemStore(cfg *StreamConfig) (*memStore, error) {\n\treturn newMemStoreWithMode(cfg, false)\n}\n\nfunc newMemStoreWithMode(cfg *StreamConfig, recovering bool) (*memStore, error) {\n\tif cfg == nil {\n\t\treturn nil, fmt.Errorf(\"config required\")\n\t}\n\tif cfg.Storage != MemoryStorage {\n\t\treturn nil, fmt.Errorf(\"memStore requires memory storage type in config\")\n\t}\n\tms := &memStore{\n\t\tmsgs:       make(map[uint64]*StoreMsg),\n\t\tfss:        stree.NewSubjectTree[SimpleState](),\n\t\tmaxp:       cfg.MaxMsgsPer,\n\t\tcfg:        *cfg,\n\t\trecovering: recovering,\n\t}\n\t// Only create a THW if we're going to allow TTLs.\n\tif cfg.AllowMsgTTL {\n\t\tms.ttls = thw.NewHashWheel()\n\t}\n\tif cfg.AllowMsgSchedules {\n\t\tms.scheduling = newMsgScheduling(ms.runMsgScheduling)\n\t\tms.scheduling.paused = recovering\n\t}\n\tif cfg.FirstSeq > 0 {\n\t\tif _, err := ms.purge(cfg.FirstSeq); err != nil {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/memstore.go#L49-L85","documentation":"Raised in newMemStoreWithMode when the supplied StreamConfig has a Storage type other than MemoryStorage. The memory-store implementation can only back streams declared with memory storage, so a file-storage stream routed here is a programming/config mismatch.","triggerScenarios":"Thrown at server/memstore.go:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set Storage: MemoryStorage in the stream config, or use the file store for durable streams","Check stream-creation code paths so the store type is selected from cfg.Storage"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}