"iTunes could not connect to the iPhone 'XXXX' because it is locked with a passcode"with XXXX being the name of my phone. It was easily fixed by waking up the phone first and then connecting, but it's clearly a bug since my phone was not locked at all. This may happen because iTunes can't tell the difference between a phone that is scheduled to lock after some period of time, but currently is just in idle mode and a phone that's actually locked.
Anyway, don't freak out if you see this message. Just re-connect after going to the home screen on your phone.