This can happen if the transaction references a Named_ID that does not exist on Names table for that account. This normally occurs if the primary name for the account (Primary_Name_ID on the Named_ID 0 name) is set to a name record that is not included on the account. Under certain circumstances, when a transaction is uploaded, it will use the primary name for the account for the name on the transaction, so if the primary name for the account is one that does not exist, you will end up with this issue.

You can see what conditions TA will use the accounts primary name in this article:

Why is a transaction (from Account Data Upload) associated with the name record rather than the whole account?

The only known way for the Primary_Name_ID for an account to be set to a Name_ID not on the account is due to old bad data from conversion. It is not a widespread problem, so it should be fixed on a case by case basis.

The Primary_Name_ID for an account can be corrected by doing the following:

1. Go to the Names Entry screen and select whatever name should actually be the primary name for the account.
2. Click the check for "Primary Contact?" to make it preferred, then close Names Entry.

This will update the Preferred_Name_ID on the Named_ID 0 record to the Named_ID for that name. It will also set the Primary_Name_Flag to 'Y' on whatever name record you have checked it on. If you do not actually want that flag set for whatever reason you can then go and uncheck the "Primary Contact?" box, and that will set Primary_Name_Flag back to ‘N’ but leave the Preferred_Name_ID on Named_ID 0 as the name you would have checked.

If you want to correct the Named_ID on the transactions that use the bad one, you will have to adjust them and change which name the items are associated within the batch.