This error can occur on publishing sites in Sharepoint when you have site collection and subsites with unique permissions. The following fix helped me:
- Go to Site Settings of the root web site of the site collection and select Master pages and page layouts
- Go to Document library settings inside _catalogs/masterpage doclib and click Permissions for this document library
- Grant “Read” permissions for “NT AUTHORITY\authenticated users” (use “Give users permission directly” option when you will grant permissions. I had problems when tried to add “NT AUTHORITY\authenticated users” to Sharepoint group – this is another available option)
After that users will be able to successfully login into subsite.