{"record":{"id":"254301aa7178f84a","repo":"nats-io/nats-server","slug":"config-required","errorCode":null,"errorMessage":"config required","messagePattern":"config required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/memstore.go","lineNumber":64,"sourceCode":"\tageChk      *time.Timer // Timer to expire messages.\n\tageChkRun   bool        // Whether message expiration is currently running.\n\tageChkTime  int64       // When the message expiration is scheduled to run.\n\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","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/memstore.go#L46-L82","documentation":"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.","triggerScenarios":"Thrown at server/memstore.go:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"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"}