Error "Operation failed because the requested database object could not be found..." when using indexedDB

firefox, html, indexeddb

Solution

This seems to be a Firefox bug. I've raised Bug 751802 - Intermittent IndexedDB write failures and my colleagues and I are busy working with the Firefox folks to help reproduce it.

For the time being there's no workaround or fix.

Problem

We're building an application that makes extensive use of IndexedDB on Firefox to store offline data. This works well most of the time but occasionally fails with errors like the following: ``` Exception... "The operation failed because the requested database object could not be found. For example, an object store did not exist but was being opened." code: "3" nsresult: "0x80660003 (NS_ERROR_DOM_INDEXEDDB_NOT_FOUND_ERR)" ``` It seems to fail in various places in the code; here is one of the culprits: ``` _writePage: (storeName, startIndex, endIndex, binder) -> writeTransaction = @connection.transaction([storeName], @idbTransaction.READ_WRITE) store = writeTransaction.objectStore(storeName) for index in [startIndex...endIndex] when (item = binder.list[index])? writeRequest = store.put(item) writeRequest.onerror = binder.failCallback() writeRequest.onsuccess = binder.successCallback() if endIndex >= binder.list.length binder.finishedRegisteringCallbacks() return setTimeout((=> @_writePage(storeName, endIndex, endIndex + @WRITE_EACH_PAGE_SIZE, binder)), @WRITE_EACH_PAGE_DELAY) null ``` The thing that puzzles me is that the failures occur infrequently, during automated tests that usually work (we're seeing one of these failures per hundreds of executions). It's worth mentioning that we're storing a lot of data too, in the order of hundreds of megabytes. Turns out the automated tests only store a few megabytes, so it's not a matter of size. Has anyone else experienced (or better yet, experienced and fixed!) this problem?

Original source