Set your "Require Accounts" preference:
Review your Item List to assure there are no items pointing to the Uncategorized accounts or Parent accounts when there are sub-accounts.
You can see the transactions affecting Uncategorized Income and Uncategorized Expenses by running a QuickReport for the Accounts:
If you entered opening balances when you created new customers:
The Customer opening balances are entered as Invoices with an item called "Opening Balance." Edit this item and change the income account from Uncategorized Income to an appropriate account, perhaps Opening Balance Equity. Be sure to consult your accountant when selecting accounts.
If you have transactions affecting Uncategorized Income and Uncategorized Expense from any other cause: