Database upgrade error: "unable to open database file"

This discussion was created from comments split from: Zotero shows database upgrade error.
  • Like Doing27, I got a data upgrade error, but without the disk I/O error message:

    Database upgrade error
    Error: Error(s) encountered during statement execution: unable to open database file
    [QUERY: DELETE FROM itemTypesCombined] [PARAMS: ] [ERROR: unable to open database file]
    Zotero.DBConnection.prototype.queryAsync<@chrome://zotero/content/xpcom/db.js:669:13
    From previous event:
    _updateCustomTables@chrome://zotero/content/xpcom/schema.js:851:11
    Zotero.Schema</this.updateSchema/updated<@chrome://zotero/content/xpcom/schema.js:198:17

    I clicked "check for upgrade" but Zotero didn't find one.

    I then made a backup copy of my Zotero directory (which is on my local HD) and renamed the Zotero directory so that Zotero would open. I pointed Zotero at the renamed directory, same error message (no surprise but thought I'd try that).

    I used the repair tool on (https://www.zotero.org/utils/dbfix/) on zotero.sqlite. Same error message.

    Reinstalled Zotero. Same error message.

    Prior to this, the last time I used Zotero successfully was maybe a month ago.

    I upgraded from Windows 10 to Windows 11 yesterday... which (you'd hope!) wouldn't matter....!

    Nothing else comes to mind right now in terms of any other hardware or software changes.

    Thanks in advance for any and all assistance!
  • That's unlikely to be a problem with the database itself — it's generally just a permissions problem within the Zotero data directory. Check the permissions of zotero.sqlite and similar files, and of the data directory itself, to make sure that your user account has full read and write access.
  • My. Zotero data is in C:\\Users\SLB\Documents\Workflow\ZoteroData.

    I checked the file properties (Windows Explorer, Properties/Security) of the Workflow and ZoteroData folders, zotero.sqlite, zotero.sqlite.bak, and zotero.sqlite.1.bak.

    The permissions for my user account are identical to the permissions of SYSTEM and administrators (ie everything is checked).

    When I click on Advanced/Effective Access and select object name Administrator and View effective access, every item is checked in green. When I select object name Users, every item is crossed in red.

    Is any of that helpful?
  • I'm afraid you'll need to debug this yourself. This is a problem on your computer, not a problem in Zotero. This just means Zotero can't access the folder or file, which would be due to either 1) permissions in either the data directory or the path leading up to it or 2) security software on your computer interfering with Zotero's ability to read from disk. You're also using a custom location, so you may have done something while setting that up to cause this.
  • edited January 26, 2022
    Note that it may help to disable auto-sync (if you're using it) and test pointing Zotero at the default different location in the home folder. If the default location, you can use that to determine the differences between that location and your custom one. If the default location doesn't work either, it's almost certainly security software.
  • Gotcha, thank you for all that helpful information, and I will proceed as you suggest. I have to say at this point I'm somewhat mystified -- eg the only security software I have is Windows Defender (but then again, did Windows 11 muck with that? It certainly mucked with other things in peculiar fashion). Ah well, hopefully the debugging will lead to enlightenment. I leave you with my all-time favorite IT joke:

    Q: How many Microsoft software engineers does it take to change a lightbulb?
    A: None, they just redefine the industry standard as darkness :)
  • edited January 27, 2022
    Problem solved!

    In case my solution is of use to someone else [but see my next comment for a much better solution] is:

    1. I renamed my existing Zotero data folder, so that Zotero would open without the "unable to open database file".

    2. I copied my existing Zotero data folder from its custom location C:\\Users\SLB\Documents\Workflow\ZoteroData) to C:\\Users\SLB\

    3. I launched Zotero.

    4. In Zotero, I changed the data directory location from the default C:\\Uses\SLB\Zotero to C:\\Users\SLB\ZoteroData
    [Edit/Preferences/Files and Folders/Data directory location]

    5. My library appeared.

    Notes:

    Before following the procedure listed above, I tried copying all my Zotero files and subfolders from my "old" custom directory to the new default directory. But that didn't help - Zotero still produced the error message "unable to open database file".

    As mentioned earlier, I upgraded to Windows 11 recently.

    Since this upgrade, I have encountered (so far) three application programs (Zotero, Quicken, and Dropbox) that didn't work properly (in various ways) with existing custom data folder locations; but worked fine after I had switched back to the application's default data folder location (a subfolder of C:\\Users\SLB\ in all three cases).
  • edited January 27, 2022
    "...recently added to Windows Defender": "Controlled Folder Access is an enterprise-class ransomware protection...When Controlled folder access is on [and my upgrade to WIndows 11 turned it on]...folders you use most often [like Documents!] will be protected by default. This means that content in any of these folders cannot be accessed or changed by any unknown or untrusted apps [including by default Zotero, Dropbox, Evernote etc!] ...." - 2 Dec 2021, https://www.windowsphoneinfo.com/threads/kb5007253-update-blocks-from-controlled-folder-access.629959/

    Windows does throw a "controlled folder access blocked" notification when this happens, however, if Focus Assist is turned on (which it was after my Windows 11 upgrade either by default or inherited from from my Win10 settings), they are silently posted to the Notification Centre. (Which I eventually looked at.)
  • Good to know — thanks for the update.
Sign In or Register to comment.