[Bug]: Restore backup fails (Error: ConnectionManager.getConnection was called after the connection manager was closed!) #2102

Closed
opened 2026-04-25 00:03:30 +02:00 by adam · 2 comments
Owner

Originally created by @xcy7e on GitHub (Jul 13, 2024).

What happened?

When trying to restore a backup, I get the following error:
2024-07-13-09-52-52-241

Log-Error:
Error: ConnectionManager.getConnection was called after the connection manager was closed!

I'll add relevant Log entries.

What did you expect to happen?

Restore the backup

Steps to reproduce the issue

  1. Create a backup
  2. Restore the backup

Audiobookshelf version

v2.11.0

How are you running audiobookshelf?

Debian/PPA

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

None

Logs

{"timestamp":"2024-07-13 09:27:47.397","source":"    at process.<anonymous> (/snapshot/audiobookshelf/server/Server.js)","message":"[Server] Unhandled rejection: Error: ConnectionManager.getConnection was called after the connection manager was closed!, promise: Promise {\n  <rejected> Error: ConnectionManager.getConnection was called after the connection manager was closed!\n      at ConnectionManager.getConnection (/snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:70:13)\n      at /snapshot/audiobookshelf/node_modules/sequelize/lib/sequelize.js:305:111\n      at /snapshot/audiobookshelf/node_modules/retry-as-promised/dist/index.js:59:25\n      at new Promise (<anonymous>)\n      at retryAsPromised (/snapshot/audiobookshelf/node_modules/retry-as-promised/dist/index.js:48:12)\n      at Sequelize.query (/snapshot/audiobookshelf/node_modules/sequelize/lib/sequelize.js:300:12)\n      at SQLiteQueryInterface.select (/snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:33)\n      at user.findAll (/snapshot/audiobookshelf/node_modules/sequelize/lib/model.js:1140:47)\n      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n      at async user.findOne (/snapshot/audiobookshelf/node_modules/sequelize/lib/model.js:1240:12)\n}","levelName":"FATAL","level":5}
{"timestamp":"2024-07-13 09:28:10.692","source":"    at process.<anonymous> (/snapshot/audiobookshelf/server/Server.js)","message":"[Server] Unhandled rejection: SequelizeDatabaseError: SQLITE_MISUSE: Database handle is closed, promise: Promise {\n  <rejected> Error\n      at Database.<anonymous> (/snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27)\n
 at /snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/sqlite/query.js:183:50\n      at new Promise (<anonymous>)\n
 at Query.run (/snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12)\n      at /snapshot/audiobookshelf/node_modules/sequelize/lib/sequelize.js:315:28\n      at async SQLiteQueryInterface.select (/snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:12)\n      at async libraryItem.findAll (/snapshot/audiobookshelf/node_modules/sequelize/lib/model.js:1140:21)\n      at async libraryItem.findOne (/snapshot/audiobookshelf/node_modules/sequelize/lib/model.js:1240:12)\n      at async libraryItem.findByPk (/snapshot/audiobookshelf/node_modules/sequelize/lib/model.js:1221:12)\n
   at async libraryItem.getOldById (/snapshot/audiobookshelf/server/models/LibraryItem.js) {\n    name: 'SequelizeDatabaseError',\n    parent: [Error: SQLITE_MISUSE: Database handle is closed] {\n      errno: 21,\n      code: 'SQLITE_MISUSE',\n      sql: \"SELECT `id`, `ino`, `path`, `relPath`, `mediaId`, `mediaType`, `isFile`, `isMissing`, `isInvalid`, `mtime`, `ctime`, `birthtime`, `size`, `lastScan`, `lastScanVersion`, `libraryFiles`, `extraData`,
`createdAt`, `updatedAt`, `libraryId`, `libraryFolderId` FROM `libraryItems` AS `libraryItem` WHERE `libraryItem`.`id` = 'e9e95f15-8f13-4afa-b9f4-7ac03d35ea83';\"\n    },\n    original: [Error: SQLITE_MISUSE: Database handle is closed] {\n      errno: 21,\n
   code: 'SQLITE_MISUSE',\n      sql: \"SELECT `id`, `ino`, `path`, `relPath`, `mediaId`, `mediaType`, `isFile`, `isMissing`, `isInvalid`, `mtime`, `ctime`, `birthtime`, `size`, `lastScan`, `lastScanVersion`, `libraryFiles`, `extraData`, `createdAt`, `updatedAt`, `libraryId`, `libraryFolderId` FROM `libraryItems` AS `libraryItem` WHERE `libraryItem`.`id` = 'e9e95f15-8f13-4afa-b9f4-7ac03d35ea83';\"\n    },\n    sql: \"SELECT `id`, `ino`, `path`, `relPath`, `mediaId`, `mediaType`, `isFile`, `isMissing`, `isInvalid`,
`mtime`, `ctime`, `birthtime`, `size`, `lastScan`, `lastScanVersion`, `libraryFiles`, `extraData`, `createdAt`, `updatedAt`, `libraryId`, `libraryFolderId` FROM `libraryItems` AS `libraryItem` WHERE `libraryItem`.`id` = 'e9e95f15-8f13-4afa-b9f4-7ac03d35ea83';\",\n    parameters: {}\n  }\n}","levelName":"FATAL","level":5}

Additional Notes

No response

Originally created by @xcy7e on GitHub (Jul 13, 2024). ### What happened? When trying to restore a backup, I get the following error: ![2024-07-13-09-52-52-241](https://github.com/user-attachments/assets/34892df4-c7e4-46dc-aea1-675a5133dc11) Log-Error: `Error: ConnectionManager.getConnection was called after the connection manager was closed!` I'll add relevant Log entries. ### What did you expect to happen? Restore the backup ### Steps to reproduce the issue 1. Create a backup 2. Restore the backup ### Audiobookshelf version v2.11.0 ### How are you running audiobookshelf? Debian/PPA ### What OS is your Audiobookshelf server hosted from? Linux ### If the issue is being seen in the UI, what browsers are you seeing the problem on? None ### Logs ```shell {"timestamp":"2024-07-13 09:27:47.397","source":" at process.<anonymous> (/snapshot/audiobookshelf/server/Server.js)","message":"[Server] Unhandled rejection: Error: ConnectionManager.getConnection was called after the connection manager was closed!, promise: Promise {\n <rejected> Error: ConnectionManager.getConnection was called after the connection manager was closed!\n at ConnectionManager.getConnection (/snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:70:13)\n at /snapshot/audiobookshelf/node_modules/sequelize/lib/sequelize.js:305:111\n at /snapshot/audiobookshelf/node_modules/retry-as-promised/dist/index.js:59:25\n at new Promise (<anonymous>)\n at retryAsPromised (/snapshot/audiobookshelf/node_modules/retry-as-promised/dist/index.js:48:12)\n at Sequelize.query (/snapshot/audiobookshelf/node_modules/sequelize/lib/sequelize.js:300:12)\n at SQLiteQueryInterface.select (/snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:33)\n at user.findAll (/snapshot/audiobookshelf/node_modules/sequelize/lib/model.js:1140:47)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async user.findOne (/snapshot/audiobookshelf/node_modules/sequelize/lib/model.js:1240:12)\n}","levelName":"FATAL","level":5} {"timestamp":"2024-07-13 09:28:10.692","source":" at process.<anonymous> (/snapshot/audiobookshelf/server/Server.js)","message":"[Server] Unhandled rejection: SequelizeDatabaseError: SQLITE_MISUSE: Database handle is closed, promise: Promise {\n <rejected> Error\n at Database.<anonymous> (/snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27)\n at /snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/sqlite/query.js:183:50\n at new Promise (<anonymous>)\n at Query.run (/snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12)\n at /snapshot/audiobookshelf/node_modules/sequelize/lib/sequelize.js:315:28\n at async SQLiteQueryInterface.select (/snapshot/audiobookshelf/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:12)\n at async libraryItem.findAll (/snapshot/audiobookshelf/node_modules/sequelize/lib/model.js:1140:21)\n at async libraryItem.findOne (/snapshot/audiobookshelf/node_modules/sequelize/lib/model.js:1240:12)\n at async libraryItem.findByPk (/snapshot/audiobookshelf/node_modules/sequelize/lib/model.js:1221:12)\n at async libraryItem.getOldById (/snapshot/audiobookshelf/server/models/LibraryItem.js) {\n name: 'SequelizeDatabaseError',\n parent: [Error: SQLITE_MISUSE: Database handle is closed] {\n errno: 21,\n code: 'SQLITE_MISUSE',\n sql: \"SELECT `id`, `ino`, `path`, `relPath`, `mediaId`, `mediaType`, `isFile`, `isMissing`, `isInvalid`, `mtime`, `ctime`, `birthtime`, `size`, `lastScan`, `lastScanVersion`, `libraryFiles`, `extraData`, `createdAt`, `updatedAt`, `libraryId`, `libraryFolderId` FROM `libraryItems` AS `libraryItem` WHERE `libraryItem`.`id` = 'e9e95f15-8f13-4afa-b9f4-7ac03d35ea83';\"\n },\n original: [Error: SQLITE_MISUSE: Database handle is closed] {\n errno: 21,\n code: 'SQLITE_MISUSE',\n sql: \"SELECT `id`, `ino`, `path`, `relPath`, `mediaId`, `mediaType`, `isFile`, `isMissing`, `isInvalid`, `mtime`, `ctime`, `birthtime`, `size`, `lastScan`, `lastScanVersion`, `libraryFiles`, `extraData`, `createdAt`, `updatedAt`, `libraryId`, `libraryFolderId` FROM `libraryItems` AS `libraryItem` WHERE `libraryItem`.`id` = 'e9e95f15-8f13-4afa-b9f4-7ac03d35ea83';\"\n },\n sql: \"SELECT `id`, `ino`, `path`, `relPath`, `mediaId`, `mediaType`, `isFile`, `isMissing`, `isInvalid`, `mtime`, `ctime`, `birthtime`, `size`, `lastScan`, `lastScanVersion`, `libraryFiles`, `extraData`, `createdAt`, `updatedAt`, `libraryId`, `libraryFolderId` FROM `libraryItems` AS `libraryItem` WHERE `libraryItem`.`id` = 'e9e95f15-8f13-4afa-b9f4-7ac03d35ea83';\",\n parameters: {}\n }\n}","levelName":"FATAL","level":5} ``` ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:03:30 +02:00
adam closed this issue 2026-04-25 00:03:30 +02:00
Author
Owner

@nichwall commented on GitHub (Jul 13, 2024):

If you still need to restore from a backup in the meantime, you can do this manually by stopping the server and extracting the backup through the file system (not using the web interface), then restarting the server.

https://www.audiobookshelf.org/guides/migration-and-backups#restoring-from-backup

@nichwall commented on GitHub (Jul 13, 2024): If you still need to restore from a backup in the meantime, you can do this manually by stopping the server and extracting the backup through the file system (not using the web interface), then restarting the server. https://www.audiobookshelf.org/guides/migration-and-backups#restoring-from-backup
Author
Owner

@xcy7e commented on GitHub (Jul 15, 2024):

Worked, thank you!

@xcy7e commented on GitHub (Jul 15, 2024): Worked, thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2102