Sometime after upgrading to Firefox 4, the built in sync function stopped working, throwing up the “Firefox encountered an error while syncing…”
To solve this, login to the Mozilla Account services with your Sync username and password, then choose “Clear Your Sync Data” from the left hand menu. This will clear all your stored sync data on the Mozilla servers.
Now try syncing Firefox again by going to the main menu and choosing Synch Now. All should work well now.