Key is getting deleted automatically from the bucket

10 views
Skip to first unread message

Tapis Gupta

unread,
Jan 7, 2026, 10:34:35 AM (13 days ago) Jan 7
to nats
Here is the bucket information 

 nats kv info NATS_SITE_IS_ACTIVE_KV_STORE --user=*** --password=***
Information for Key-Value Store Bucket NATS_SITE_IS_ACTIVE_KV_STORE created 2025-06-05T17:14:23+04:30

Configuration:

          Bucket Name: NATS_SITE_IS_ACTIVE_KV_STORE
         History Kept: 64
        Values Stored: 64
   Backing Store Kind: JetStream
          Description: Bucket to Store the current state of this site - the key in this bucket will hold the value true or false
          Bucket Size: 4.8 KiB
  Maximum Bucket Size: unlimited
   Maximum Value Size: unlimited
     JetStream Stream: KV_NATS_SITE_IS_ACTIVE_KV_STORE
              Storage: File

  Cluster Information:

                Name: drl-dr
              Leader: drl-dr-eh-nats-2
             Replica: drl-dr-eh-nats-0, current, seen 0.11s ago
             Replica: drl-dr-eh-nats-1, current, seen 0.11s ago

This bucket was misbehaving and key was getting deleted immediately after create/update.

Below command was used to create/update key in bucket 

Command : nats kv put NATS_SITE_IS_ACTIVE_KV_STORE IS_ACTIVE true --user=*** --password=***
Output : true

Immediately after above command we tried to retrieve the key
 
Command : nats kv get NATS_SITE_IS_ACTIVE_KV_STORE  IS_ACTIVE --user=*** --password=***
Output :  nats: error: nats: key not found

Associated stream shows increased delete count 

nats --user=** --password=** str report
Obtaining Stream stats

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                              Stream Report                                                                              │
├─────────────────────────────────┬─────────┬──────────────────┬───────────┬───────────┬─────────┬──────┬─────────┬───────────────────────────────────────────────────────┤
│ Stream                          │ Storage │ Placement        │ Consumers │ Messages  │ Bytes   │ Lost │ Deleted │ Replicas                                              │
├─────────────────────────────────┼─────────┼──────────────────┼───────────┼───────────┼─────────┼──────┼─────────┼───────────────────────────────────────────────────────┤
│ KV_NATS_SITE_IS_ACTIVE_KV_STORE │ File    │                  │         0 │ 54,664    │ 4.0 MiB │ 0    │  184618│ drl-dr-eh-nats-0*, drl-dr-eh-nats-1, drl-dr-eh-nats-2 │
╰─────────────────────────────────┴─────────┴──────────────────┴───────────┴───────────┴─────────┴──────┴─────────┴───────────────────────────────────────────────────────╯ 

I want to understand what is causing deletion of the bucket key.

Note : Issue was resolved after deleting the bucket and recreating it with same configuration. 
 
Reply all
Reply to author
Forward
0 new messages