I recently faced the below error when trying to import a BAI2 format bank statement file in Microsoft Dynamics 365 Finance (Service update 10.0.28) version.

The bank statement file had correct bank account. The issue was due to another bank setup in a different legal entity with the same account number.
After correcting the bank account the import process worked fine.

If you are facing the same error when worth checking for the duplicate bank account number in another legal entity.