Problem arises after deleting questions and when trying to delete categories:
Course Administration block, click Questions.
Chose the main category with a large number of sub-categories containing over 550 questions.
Ensure "Display questions from sub-categories too" is checked.
Click "Show all 550 questions" at the bottom of page.
Click Select All, then Delete.
Click "Yes" to confirm deletion.
Click on Categories tab, See all categories, sub-categories and sub-sub-categories.
Click on 'X' (delete button) next to any category
Get error: "Category ID is invalid"
Clicking back on Browser, and then clicking on Questions tab, Import tab or Export tab all result in "Category ID is invalid" error.
Going back to course (clicking on course name in breadcrumb navigation) and clicking Questions in Admin block to get back to the same location, I am now able to delete categories without problems.