We have a lot of macros to manage error handling. One is WT_ERR_NOTFOUND_OK/WT_RET_NOTFOUND_OK (there are corollaries for other error returns as well). Those macros clear the value of ret that is being ignored - there are cases where follow on code would like to make a decision based on the error code. We could add new macros that don't clear the expected error.
Example code:
https://github.com/wiredtiger/wiredtiger/blame/develop/src/history/hs.c#L837
If that code doesn't match the problem described any longer, look for ret = __wt_hs_cursor