Sync Errors

Several common problems that players experience with Habitica are caused by sync errors. This page explains what syncing is, how sync errors occur, and how to avoid or minimize them. If you don't want to read the whole page, start at How to Minimize Sync Errors.
==Browser to Server Syncing==
Habitica has a server that stores data for all players and that does most of the work required to keep the site running.
However, some of the site's code also runs in the player's browser to provide a rapid response to the player's actions. When the player takes an action (such as ticking off a task), the browser immediately calculates the effects of that action (usually the experience and gold earned), and it displays those results to the user. It then sends a message to the server containing the user action.
The server receives the message and updates the stored data for that player. The server then sends a complete copy of the player's stored data back to the browser so that the browser has the most up-to-date information. This can include recent events that the browser did not previously know about (e.g., skills cast on the player by party members), so that the browser can display those events to the player. When the browser receives the complete copy of the player's data, it discards its own local, out-of-date copy, and replaces it with the fresh data from the server.
==Sync Errors==
Sometimes, when the player takes an action and the browser tries to send that action to the server, the message is not received and a sync error occurs. The player sees the action take effect in the browser, but the server never learns about it. Thus, the action is never added to the server's stored data.
When the player takes a future action, the browser sends the new action to the server, the server receives that action, and sends the complete copy of the player's stored data back to the browser. However, that data does not include the previous, unsynced action that the server never found out about. As described above, when the browser receives the data from the server, it uses that data exclusively, so all effects of the unsynced action are reversed (e.g., if the player had gained experience and gold from the unsynced action, then that experience and gold will be removed). This reversal might seem like a bad idea, but it is necessary for the browser to take on all of the stored data from the server, otherwise the server would never be able to tell the browser about events such as skills cast on the player.
==How to Minimize Sync Errors==
Sync errors often occur when the player performs several actions in quick succession (e.g., ticking off several Dailies within a few seconds). This overloads the browser, preventing it from sending some or all of the actions to the server. Although errors in gold or experience should be somewhat consistent with the tasks that didn't sync correctly, sync errors can result in odd, inconsistent results.
To prevent this, after you have taken an action, take notice of the thin blue line that runs at the top of the screen. It travels from left to right to indicate the progress of syncing from your browser to the server and back again. When the line has disappeared, syncing is finished. It is safe to perform another action. (If the blue line does not appear after your action, it is because that particular action does not require syncing.)
Often, you can actually successfully perform actions without waiting for syncing to finish, but if you want to be certain of not getting sync errors, you should wait for the blue line to disappear between each action.
This is especially important with critical actions such as ticking off Dailies near the end of the day or Resting in the Inn. If you tick off several Dailies rapidly at the same time, it's very likely that some of them won't be synced to the server, and then when your Cron runs, the server will not know that you did those Dailies and you may lose Health and your Perfect Day bonus. If you check in to the Inn and a sync error occurs, you will not actually be Resting in the Inn and will not be protected from damage from your uncompleted Dailies.
To test whether a sync error has occurred, click the sync button in the top right hand corner of the window (it looks like a circular arrow). That will cause your browser to fetch your stored data from the server. After the sync has completed (i.e., when the thin blue line has disappeared), examine your Dailies, or your Resting in the Inn status, or any other information that is important to you. If you discover that any actions you took were not synced, repeat those actions and then resync to test again.
You can also use the User Data Display tool to check for sync errors because it reads your stored data directly from the server. It will tell you which Dailies have not yet been ticked off and whether you are Resting in the Inn ("ZzzZzzzz" will appear in the dashboard if you are).
Sync errors can also be caused by unreliable internet connections, so if you are noticing problems with your net connection, be more alert than usual about checking for sync errors.
==Common Examples of Sync Errors==
Sync errors can happen with any kind of action in Habitica, but here are some common examples.
===Completing most/all Dailies but still losing health and streaks===
As described above, ticking off several Dailies quickly often causes sync errors. The server never finds out that you ticked them. You can lose health overnight and the streaks for those Dailies will be reset to zero. You will also cause damage to your party members if you are on a boss quest. Just before you stop using Habitica for the day, use the sync button or the User Data Display tool to check that your Dailies really have been marked as completed. To compensate for health lost due to a sync error, use Fix Character Values under Settings to restore your health, and also add one level if you died due to a sync error. You can restore your Dailies' streaks in their Advanced Options.
===Losing gold or experience or mana for no apparent reason===
If you tick off a task, your browser will give you experience, gold, and mana. However, if a sync error occurred for that task, the next time the browser syncs with the server, you will lose those rewards and the task will become unticked. You will see notifications with negative values, showing you that the rewards are being removed. You can regain them by finding the unticked task and ticking it off again (it can be difficult to identify a Habit that was unticked).
===Equipment that you recently bought has disappeared===
If a sync error occurs when you buy a piece of equipment, the equipment will disappear from your inventory and will become available for purchase again after resync. You might need to reload your browser or clear your browser's cache before you see items in the Rewards column. The gold that you spent to buy the equipment should be restored to you automatically. If it is not, you can use Fix Character Values under Settings to restore it.
===Pets that you hatched or fed into mounts have disappeared===
If a sync error occurs when you hatch a pet, when your browser resyncs with the server, the pet will disappear, because it has not been registered as hatched. The egg and hatching potion that you used will be returned to you. You might need to reload your browser or clear your browser's cache before you see them in your inventory. You can then re-hatch the pet.
Similarly, if a sync error occurs when you feed a pet to turn it into a mount, then when your browser resyncs with the server, the mount will disappear. The pet and used food will be returned to you. You might need to reload your browser or clear your browser's cache before you see them in your inventory. You can then feed the pet again.
===Skills cast in rapid succession can produce error messages===
If you cast several skills too quickly, sync errors can occur. Any mana that you spent on unsynced skills will be returned to you. You can recast the skills again, more slowly this time so that they register.
ru:Ошибки синхронизации
fr:Erreurs de Synchronisation
zh:同步错误
Category:Troubleshooting
Category:ToBeReviewed
Category:Pages with files missing alt tags