I'm currently handling a PR for a mitigation of said problem: janstarke/ntdsextract2#16
There seems to be a situation in which the first call to libesedb_record_get_number_of_values() fails, while a subsequent call to the same function succeeds. Can you imagine a situation in which this might happen?
Unfortunately, it is not possible to provide the data which causes this behaviour 😢