{"record":{"id":"e51ad3dce8f29576","repo":"nats-io/nats-server","slug":"sublist-notification-already-registered","errorCode":null,"errorMessage":"sublist: notification already registered","messagePattern":"sublist: notification already registered","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/sublist.go","lineNumber":46,"sourceCode":"// interested subscribers. Subscribers can have wildcard subjects to\n// match multiple published subjects.\n\n// Common byte variables for wildcards and token separator.\nconst (\n\tpwc   = '*'\n\tpwcs  = \"*\"\n\tfwc   = '>'\n\tfwcs  = \">\"\n\ttsep  = \".\"\n\tbtsep = '.'\n)\n\n// Sublist related errors\nvar (\n\tErrInvalidSubject    = errors.New(\"sublist: invalid subject\")\n\tErrNotFound          = errors.New(\"sublist: no matches found\")\n\tErrNilChan           = errors.New(\"sublist: nil channel\")\n\tErrAlreadyRegistered = errors.New(\"sublist: notification already registered\")\n)\n\nconst (\n\t// cacheMax is used to bound limit the frontend cache\n\tslCacheMax = 1024\n\t// If we run a sweeper we will drain to this count.\n\tslCacheSweep = 256\n\t// plistMin is our lower bounds to create a fast plist for Match.\n\tplistMin = 256\n)\n\n// SublistResult is a result structure better optimized for queue subs.\ntype SublistResult struct {\n\tpsubs []*subscription\n\tqsubs [][]*subscription // don't make this a map, too expensive to iterate\n}\n\n// A Sublist stores and efficiently retrieves subscriptions.","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/sublist.go#L28-L64","documentation":"RegisterNotification: the exact channel being registered is already present in that subject's notification list, so the duplicate registration is rejected instead of double-notifying on changes.","triggerScenarios":"Thrown at server/sublist.go:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reuse the existing registration instead of re-registering","Snapshot-and-clear or unregister before re-registering the same channel","Track registrations caller-side to avoid duplicates"],"exampleFix":null,"handlingStrategy":"try-catch","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"}