This generally happens when the account code is deactivated. You may activate the accounting code under Settings>>Chart of Accounts, filter the status with Archived, select Edit under the Action drop-down related to the account and activate the account.

Please refer below screenshot for more help.

Click here to watch how to make nominal codes active / inactive