{"record":{"id":"6577de7f5393b4ac","repo":"nats-io/nats-server","slug":"could-not-register-snapshot-delivery-interest-for","errorCode":null,"errorMessage":"could not register snapshot delivery interest for %q: %w","messagePattern":"could not register snapshot delivery interest for %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/jetstream_api.go","lineNumber":4619,"sourceCode":"\tchunkSize = min(max(1024, chunkSize), 1024*1024) // Clamp within 1KiB to 1MiB\n\twndSize = min(max(1024, wndSize), 32*1024*1024)  // Clamp within 1KiB to 32MiB\n\twndSize = max(wndSize, chunkSize)                // Guarantee at least one chunk\n\tmaxInflight := wndSize / chunkSize               // Between 1 and 32,768\n\n\t// Setup for the chunk stream.\n\treply := req.DeliverSubject\n\tr := sr.Reader\n\tdefer r.Close()\n\n\t// In case we run into an error, this allows subscription callbacks\n\t// to not sit and block endlessly.\n\tdone := make(chan struct{})\n\tdefer close(done)\n\n\t// Check interest for the snapshot deliver subject.\n\tinch := make(chan bool, 1)\n\tif err := acc.sl.RegisterNotification(req.DeliverSubject, inch); err != nil {\n\t\treturn fmt.Errorf(\"could not register snapshot delivery interest for %q: %w\", req.DeliverSubject, err)\n\t}\n\tdefer acc.sl.ClearNotification(req.DeliverSubject, inch)\n\thasInterest := <-inch\n\tif !hasInterest {\n\t\t// Allow 2 seconds or so for interest to show up.\n\t\tselect {\n\t\tcase <-inch:\n\t\tcase <-time.After(2 * time.Second):\n\t\t}\n\t}\n\n\t// One slot per chunk. Each chunk read takes a slot, each ack will\n\t// replace it. Smooths out in-flight number of chunks.\n\tslots := make(chan struct{}, maxInflight)\n\tfor range maxInflight {\n\t\tslots <- struct{}{}\n\t}\n","sourceCodeStart":4601,"sourceCodeEnd":4637,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/jetstream_api.go#L4601-L4637","documentation":"Server-side snapshot (stream/consumer backup) setup error. Before delivering a snapshot the server registers a notification interest on req.DeliverSubject via the account's subscription list; if registration fails (interest system error), the snapshot is aborted and this wrapped error is returned.","triggerScenarios":"Calling stream/consumer snapshot/backup API (jsm stream backup / consumer backup) where acc.sl.RegisterNotification fails for the requested DeliverSubject.","commonSituations":"Interest registration failures under heavy subscription churn or with interest-mode issues in leafnode/gateway setups; malformed or colliding deliver subjects from custom snapshot tooling.","solutions":["Retry the snapshot with a fresh, unique DeliverSubject","Check server logs and subscription-list state for interest registration errors; investigate leafnode/gateway interest propagation","Ensure the snapshot consumer subscribes to the deliver subject promptly so interest exists"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"deliverSubject := nats.NewInbox() // fresh unique subject per snapshot attempt","typeGuard":null,"tryCatchPattern":"err := doSnapshot(req)\nif err != nil && strings.Contains(err.Error(), \"could not register snapshot delivery interest\") {\n\treq.DeliverSubject = nats.NewInbox()\n\treturn doSnapshot(req) // retry with fresh subject\n}","preventionTips":["Generate a unique inbox DeliverSubject for each snapshot request","Subscribe to the deliver subject immediately after initiating the snapshot","Investigate leafnode/gateway interest propagation if it recurs"],"tags":["jetstream","snapshot","interest","nats-server"],"backgroundTag":"snapshot-interest-registration-failed","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}