-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Replication, Replication - Oplog and Recovery
-
ALL
-
Repl 2026-11-09, Repl 2026-11-23
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The delete branch of applyOperation_inlock in src/mongo/db/repl/oplog.cpp decides whether to record a change-stream pre-image before it runs the delete, then asserts that a pre-image was produced. The decision helper shouldRecordChangeStreamPreImage() (src/mongo/db/repl/oplog.cpp:2579-2591) looks only at whether the collection has changeStreamPreAndPostImages enabled and at the oplog application mode; it never checks that the document being deleted exists. When the delete matches nothing, deleteObject() returns a default-constructed result with no pre-image (src/mongo/db/query/write_ops/delete.cpp:56-60), and invariant(result.requestedPreImage) at src/mongo/db/repl/oplog.cpp:3287-3288 fires and aborts the process. The code that gracefully handles a zero-document delete sits just below the assertion (src/mongo/db/repl/oplog.cpp:3292-3375) and is never reached. The input that reaches it is an applyOps command whose client-supplied oplogApplicationMode field is set to "Secondary" or "Recovering" (parsed at src/mongo/db/commands/apply_ops_cmd.cpp:331-350 and src/mongo/db/repl/oplog.cpp:1826-1842) together with a delete entry for an _id that does not exist.