{"record":{"id":"30f58b5aa59c99b1","repo":"nats-io/nats-server","slug":"bad-consumer-config-30f58b","errorCode":null,"errorMessage":"bad consumer config","messagePattern":"bad consumer config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/memstore.go","lineNumber":2600,"sourceCode":"\ntype consumerMemStore struct {\n\tmu     sync.Mutex\n\tms     StreamStore\n\tname   string\n\tcfg    ConsumerConfig\n\tstate  ConsumerState\n\tclosed bool\n}\n\nfunc (ms *memStore) ConsumerStore(name string, _ time.Time, cfg *ConsumerConfig) (ConsumerStore, error) {\n\tif ms == nil {\n\t\treturn nil, fmt.Errorf(\"memstore is nil\")\n\t}\n\tif ms.isClosed() {\n\t\treturn nil, ErrStoreClosed\n\t}\n\tif cfg == nil || name == _EMPTY_ {\n\t\treturn nil, fmt.Errorf(\"bad consumer config\")\n\t}\n\to := &consumerMemStore{ms: ms, name: name, cfg: *cfg}\n\tms.AddConsumer(o)\n\treturn o, nil\n}\n\nfunc (ms *memStore) AddConsumer(o ConsumerStore) error {\n\tms.mu.Lock()\n\tms.consumers = append(ms.consumers, o)\n\tms.mu.Unlock()\n\treturn nil\n}\n\nfunc (ms *memStore) RemoveConsumer(o ConsumerStore) error {\n\tms.mu.Lock()\n\tfor i, cfs := range ms.consumers {\n\t\tif o == cfs {\n\t\t\tms.consumers = append(ms.consumers[:i], ms.consumers[i+1:]...)","sourceCodeStart":2582,"sourceCodeEnd":2618,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/memstore.go#L2582-L2618","documentation":"Validation guard in memStore.ConsumerStore: consumer creation was attempted with a nil ConsumerConfig or an empty consumer name; both are required to instantiate a consumerMemStore.","triggerScenarios":"Thrown at server/memstore.go:2600 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty durable/name and a fully populated ConsumerConfig when creating the consumer","Validate consumer add requests at the JetStream API layer before they reach the store"],"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"}