etcd-io/etcd · error
unexpected createdNotify in delete
Error message
unexpected createdNotify in delete
What it means
OpDelete rejects WithCreatedNotify. createdNotify asks a watch to emit a synthetic event when the watch is established; it has no meaning for a delete operation. After applyOpts sets ret.createdNotify, the final validation case panics with "unexpected createdNotify in delete".
Source
Thrown at client/v3/op.go:295
panic("unexpected lease in delete")
case ret.limit != 0:
panic("unexpected limit in delete")
case ret.rev != 0:
panic("unexpected revision in delete")
case ret.sort != nil:
panic("unexpected sort in delete")
case ret.serializable:
panic("unexpected serializable in delete")
case ret.countOnly:
panic("unexpected countOnly in delete")
case ret.minModRev != 0, ret.maxModRev != 0:
panic("unexpected mod revision filter in delete")
case ret.minCreateRev != 0, ret.maxCreateRev != 0:
panic("unexpected create revision filter in delete")
case ret.filterDelete, ret.filterPut:
panic("unexpected filter in delete")
case ret.createdNotify:
panic("unexpected createdNotify in delete")
}
return ret
}
// OpPut returns "put" operation based on given key-value and operation options.
func OpPut(key, val string, opts ...OpOption) Op {
ret := Op{t: tPut, key: []byte(key), val: []byte(val)}
ret.applyOpts(opts)
switch {
case ret.end != nil:
panic("unexpected range in put")
case ret.limit != 0:
panic("unexpected limit in put")
case ret.rev != 0:
panic("unexpected revision in put")
case ret.sort != nil:
panic("unexpected sort in put")
case ret.serializable:View on GitHub (pinned to f744d457f4)
Solutions
- Remove WithCreatedNotify from Delete calls; it is exclusively a Watch option.
- Keep watch-construction options in a separate slice from mutation options.
Example fix
// before _, err := cli.Delete(ctx, watchedKey, clientv3.WithCreatedNotify()) // panics // after _, err := cli.Delete(ctx, watchedKey)
Defensive patterns
Strategy: validation
Prevention
- WithCreatedNotify is a Watch-only option; strip watch options before calling Delete/Put.
- In watch-lifecycle components, maintain distinct option slices for watch setup vs key teardown.
- Any 'unexpected X in delete/put' panic means a read/watch option leaked into a write path.
When it happens
Trigger: clientv3.OpDelete(k, clientv3.WithCreatedNotify()); copy-pasting a Watch option list into the cleanup Delete of a watch-based component; generic option forwarding from watch setup into teardown.
Common situations: Watch lifecycle code: the same helper that builds watch options (WithCreatedNotify, WithProgressNotify, WithPrevKey) is reused for deleting the watched key on shutdown; config bundles applied to all clientv3 calls.
Related errors
- unexpected lease in delete
- unexpected limit in delete
- unexpected revision in delete
- unexpected sort in delete
- unexpected serializable in delete
AI-assisted analysis of etcd-io/etcd@f744d457f4 (2026-08-15).
Data as JSON: /api/errors/2db6abaf59f37234.
Report an issue: GitHub.