diff -ur a/flag.module b/flag.module
--- a/flag.module	2011-09-08 23:08:43.000000000 +0400
+++ b/flag.module	2012-02-08 13:09:56.000000000 +0400
@@ -561,15 +561,20 @@
 function flag_user_login(&$edit, &$account) {
   // Migrate anonymous flags to this user's account.
   if (module_exists('session_api') && ($sid = flag_get_sid(0))) {
-    // The @ symbol suppresses errors if the user flags a piece of content
-    // they have already flagged as a logged-in user.
-    @db_update('flag_content')
+    $subquery = db_select('flag_content', 'fc')
+                ->fields('fc')
+                ->condition('uid', $account->uid)
+                ->condition('sid', 0)
+                ->where('fc.fid=flag_content.fid AND fc.content_id=flag_content.content_id');
+
+    db_update('flag_content')
       ->fields(array(
         'uid' => $account->uid,
         'sid' => 0,
       ))
       ->condition('uid', 0)
       ->condition('sid', $sid)
+      ->notExists($subquery)
       ->execute();
 
     // Delete any remaining flags this user had as an anonymous user.
