Open Bug 1199094 Opened 5 years ago Updated 1 year ago

Failed to restore bookmarks from {path} ... UNIQUE constraint failed: moz_keywords.keyword

Categories

(Toolkit :: Places, defect, P3)

defect

Tracking

()

People

(Reporter: markh, Unassigned)

References

Details

I've got a test profile I'm abusing for Sync. If I delete places.sqlite for the profile and restart the browser, the browser console shows:

> Failed to restore bookmarks from [profile_dir]\bookmarkbackups\bookmarks-2015-08-27_522_zcyzTfDxe5E3BVL2MsRZPA==.jsonlz4: Error: Error(s) encountered during statement execution: UNIQUE constraint failed: moz_keywords.keyword BookmarkJSONUtils.jsm:111:0
> ...
> A promise chain failed to handle a rejection. Did you forget to '.catch', or did you forget to 'return'?
> See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise
> Date: Thu Aug 27 2015 16:07:33 GMT+1000 (AUS Eastern Standard Time)
> Full Message: Error: Error(s) encountered during statement execution: UNIQUE constraint failed: moz_keywords.keyword
> Full Stack: ConnectionData.prototype<._executeStatement/pending<.handleCompletion@resource://gre/modules/Sqlite.jsm:800:25

The bookmarks backup in question does have duplicates - eg, the following entries exist:

{
  u'dateAdded': 1440062732519000L,
  u'guid': u'KuHZir35HFXR',
  u'id': 96,
  u'index': 0,
  u'keyword': u'nab',
  u'lastModified': 1440062732519000L,
  u'postData': None,
  u'title': u'Welcome to National Internet Banking',
  u'type': u'text/x-moz-place',
  u'uri': u'https://ib.national.com.au/nabib/login.jsp'},
}

{
  u'dateAdded': 1440062733950000L,
  u'guid': u'GP5Vkn7ylURL',
  u'id': 226,
  u'index': 0,
  u'keyword': u'nab',
  u'lastModified': 1440062733950000L,
  u'postData': None,
  u'title': u'Welcome to National Internet Banking',
  u'type': u'text/x-moz-place',
  u'uri': u'https://ib.national.com.au/nabib/login.jsp'
},

(ignore the strange leading 'u' etc - I ran it though a one-line Python script to pretty-print it)

The dupes are almost certainly to do with the Sync abuse I'm doing (and trying to track down) but that message in the console implies the import isn't quite doing the right thing as it attempts to recover.

I can share the entire backup if desired, but I'd prefer not to attach it to a public bug - it started out as a clone of my "real" profile.
hm, this is trying to add a second keyword entry when one already exists, and the schema complains. I suspect its due to the old keywords API that has a more direct access to the schema than the new one (but the new one is async).
Priority: -- → P3
Depends on: 1313188
You need to log in before you can comment on or make changes to this bug.