"Can refer row only if the charge type is 'On Previous Row Amount' or 'Previous Row Total'"

I’m facing the same issue but because of create POS Closing Entry.
My solution is to modify erpnext code in:

erpnext/accounts/doctype/pos_invoice_merge_log.py

I change line 258, from :

tax.charge_type = "Actual"

to

in case in the future anybody facing the same issue and need solution.

Here is my other thread related to my issue
https://discuss.frappe.io/t/error-while-doing-pos-closing-entry/110620