Custom plugin settings page with tab. Error: “Sorry, you are not allowed to access this page.”

I’ve found that there are two causes for this error when developing with the settings API:

  1. you are not running under the ‘admin_menu’ hook
  2. some other error has occurred, check the error log.

Both of these derive from current_user not being available at the time.