Purchase invoice total price not updated

This happened with me multiple times the total price is not being updated when entering the rate and quantity unless removing the item and adding it again, why?

I checked the console and find the errors:
formatters.js:421 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘parent’)
at frappe.format (formatters.js:421:9)
at ii.refresh_field (grid_row.js:1550:17)
at oo.set_value (grid.js:872:40)
at form.js:325:41
at model.js:560:27
formatters.js:421 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘parent’)
at frappe.format (formatters.js:421:9)
at ii.refresh_field (grid_row.js:1550:17)
at window.refresh_field (script_helpers.js:25:14)
at frappe.ui.form.Controller.conversion_factor (transaction.js:1571:4)
at transaction.js:1637:16