An unexpected website was found check idSite in the request

When logging in as admin to an existing Piwik 1.12 install, I get the following error:

The requested website id = 1 (or its property ts_created) couldn’t be found

If I change the idSite variable in the querystring I can get past the error and get to other sites, settings, etc.

We are now trying to update Piwik to the most recent version, but in order to do that we needed to update PHP, mySQL, etc. I built a test VM and installed a turnkey image and migrated the existing Piwik install according to instructions. I was then able to update to 2.2.2 but when trying to log in as admin I get a slightly different error:

An unexpected website was found, check idSite in the request.

Strange thing is I can change the querystring and get to other reports, but I can no longer get to Settings (give the same above error). I’ve checked the piwik_site table and there is no idSite #1 (it’s missing or has been deleted), but simply changing the idSite doesn’t fix the problem (not that I expected it to.)

It would seem whatever issue existed in version 1.12 was not corrected by updating to 2.2.2. Is this a known issue or is there a fix? I will provide any additional info if needed. Thanks.

It seems that the site has somehow disappeared/been deleted.

However you can go to(when logged in)
your.piwik-host.com/index.php?module=UsersManager&action=userSettings

There you can change the default site loaded after a login.

please upgrade to Piwik 2 where this bug should be fixed

I believe the issue was idSite #1 was deleted at some point (as opposed to a bug) and changing the default site seemed to clear it up.