{"record":{"id":"e147697be8e75a91","repo":"nats-io/nats-server","slug":"no-interest","errorCode":null,"errorMessage":"no interest","messagePattern":"no interest","errorType":"http","errorClass":null,"httpStatus":408,"severity":"warning","filePath":"server/jetstream_api.go","lineNumber":4661,"sourceCode":"\t\tcase <-done:\n\t\t}\n\t})\n\tdefer mset.unsubscribe(ackSub)\n\n\tvar hdr []byte\n\tchunk := make([]byte, chunkSize)\n\terrCh := sr.errCh\n\tvar snapshotErr error\n\tackTimer := time.NewTimer(snapshotAckTimeout)\n\tdefer stopAndClearTimer(&ackTimer)\n\t// index only incremented when a chunk is actually being sent.\n\tfor index := 1; ; {\n\t\tselect {\n\t\tcase <-slots:\n\t\t\t// A slot has become available.\n\t\tcase <-inch:\n\t\t\t// The receiver appears to have gone away.\n\t\t\tsnapshotErr = errors.New(\"no interest\")\n\t\t\thdr = []byte(\"NATS/1.0 408 No Interest\\r\\n\\r\\n\")\n\t\t\tgoto done\n\t\tcase err, ok := <-errCh:\n\t\t\tif !ok {\n\t\t\t\t// Channel closed normally, e.g. on completion.\n\t\t\t\terrCh = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// The snapshotting goroutine has failed for some reason.\n\t\t\tsnapshotErr = err\n\t\t\thdr = fmt.Appendf(nil, \"NATS/1.0 500 %s\\r\\n\\r\\n\", err)\n\t\t\tgoto done\n\t\tcase <-ackTimer.C:\n\t\t\t// It's taking a very long time for the receiver to send us acks,\n\t\t\t// they have probably stalled or there is high loss on the link.\n\t\t\tsnapshotErr = errors.New(\"no flow response\")\n\t\t\thdr = []byte(\"NATS/1.0 408 No Flow Response\\r\\n\\r\\n\")\n\t\t\tgoto done","sourceCodeStart":4643,"sourceCodeEnd":4679,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/jetstream_api.go#L4643-L4679","documentation":"During a JetStream stream snapshot/backup the server streams chunks to a receiver that must keep an interest in the delivery subject. If the server detects the receiver's subscription is gone (after a 2s grace period), it aborts the snapshot and reports 408 'No Interest'.","triggerScenarios":"The client issuing the snapshot request unsubscribes from or never subscribes to the delivery/reply inbox; the request context is cancelled mid-snapshot; the connection drops, removing the interest.","commonSituations":"Client-side request timeouts firing during large stream backups; closing the NATS connection mid-snapshot; snapshot helpers that cancel the inbox subscription when the app call returns; network idle timeouts.","solutions":["Keep the snapshot client's reply-subject subscription alive for the entire snapshot (do not cancel the request early).","Increase client request timeouts so large streams are not abandoned mid-transfer.","Fix connection stability / reconnect handling and re-issue the snapshot.","Retry the snapshot once the receiver is stable; the abort is transient."],"exampleFix":"// before: request may time out and drop interest mid-snapshot\ncancelCtx, _ := context.WithTimeout(ctx, 5*time.Second)\nsnapshotStream(js, \"ORDERS\", w) // aborted with 'no interest'\n// after: allow enough time and keep the subscription alive\nsnapCtx, _ := context.WithTimeout(ctx, 30*time.Minute)\nerr := snapshotStream(js, \"ORDERS\", w)\nif err != nil && strings.Contains(err.Error(), \"no interest\") {\n\tlog.Fatalf(\"receiver lost interest during snapshot: %v\", err)\n}","handlingStrategy":"retry","validationCode":"// confirm the request context/subscription is alive before snapshotting\nif ctx.Err() != nil {\n\treturn fmt.Errorf(\"snapshot context already cancelled: %w\", ctx.Err())\n}","typeGuard":"func isSnapshotNoInterest(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"no interest\")\n}","tryCatchPattern":"err := snapshotStream(js, \"ORDERS\", w)\nif isSnapshotNoInterest(err) {\n\ttime.Sleep(time.Second)\n\treturn snapshotStream(js, \"ORDERS\", w) // receiver dropped interest: re-subscribe and retry\n}","preventionTips":["Never cancel the request context or unsubscribe while a snapshot is in flight.","Set client request timeouts larger than the expected snapshot duration.","Keep the reply inbox subscribed through reconnects.","Verify connection stability before starting long backups."],"tags":["jetstream","snapshot","timeout","network"],"backgroundTag":"subscriber-interest-lost","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}