-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
bugSomething isn't workingSomething isn't workingstatus/reproducedBug has been reproducedBug has been reproduced
Description
π Bug Description
Txn.NewIterator / Txn.NewKeyIterator panic on invalid runtime state and invalid options instead of returning a normal error.
Affected code:
txn_iterator.go:113txn_iterator.go:170
Current panic cases include:
- transaction already discarded
- DB already closed
NewKeyIteratorcalled with non-emptyopt.Prefix
π Reproduction Steps
Steps to reproduce the behavior:
- Create a transaction and call
Discard(). - Call
txn.NewIterator(...)ortxn.NewKeyIterator(...). - Or call
txn.NewKeyIterator(key, IteratorOptions{Prefix: []byte("x")}). - Observe process panic.
π Expected Behavior
Iterator construction should fail with an explicit error path (or safe API variant) instead of panicking and potentially crashing the service process.
πΈ Screenshots / Logs
Observed panic messages:
Transaction has already been discardedopt.Prefix should be nil for NewKeyIterator.
π» Environment
- OS: macOS (arm64)
- Go Version: 1.26
- NoKV Version: main (2026-02-14)
π§ Additional Context
This is an API robustness issue. panic may be acceptable for internal invariants, but these paths are easy to trigger from caller misuse and can crash long-running services.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingstatus/reproducedBug has been reproducedBug has been reproduced
Projects
Status
Todo