Server shutdown on bad metadata #561

Closed
opened 2026-04-24 23:13:01 +02:00 by adam · 4 comments
Owner

Originally created by @wtanksleyjr on GitHub (Aug 1, 2022).

...as a side note, it would be nice to have more information about what file is causing problems - I've seen a lot of errors, and I've never seen info about what filenames are causing them.

audiobookshelf_1  | [2022-08-01 19:41:26]  WARN: [abmetadataGenerator] Invalid chapter
audiobookshelf_1  | [2022-08-01 19:42:52]  INFO: [Book] Overdrive Media Markers and preference found! Using these for chapter definitions
audiobookshelf_1  | [2022-08-01 19:42:52]  INFO: [parseOverdriveMediaMarkers] Parsing of Overdrive Media Markers started
audiobookshelf_1  | [2022-08-01 19:42:52]  INFO: [Book] Overdrive Media Markers and preference found! Using these for chapter definitions
audiobookshelf_1  | [2022-08-01 19:42:52]  INFO: [parseOverdriveMediaMarkers] Parsing of Overdrive Media Markers started
audiobookshelf_1  | [2022-08-01 19:42:52]  INFO: [Book] Overdrive Media Markers and preference found! Using these for chapter definitions
audiobookshelf_1  | [2022-08-01 19:42:52]  INFO: [parseOverdriveMediaMarkers] Parsing of Overdrive Media Markers started
audiobookshelf_1  | [2022-08-01 19:42:52]  INFO: [Book] Overdrive Media Markers and preference found! Using these for chapter definitions
audiobookshelf_1  | [2022-08-01 19:42:52]  INFO: [parseOverdriveMediaMarkers] Parsing of Overdrive Media Markers started
audiobookshelf_1  | [2022-08-01 19:42:52]  INFO: [Book] Overdrive Media Markers and preference found! Using these for chapter definitions
audiobookshelf_1  | [2022-08-01 19:42:52]  INFO: [parseOverdriveMediaMarkers] Parsing of Overdrive Media Markers started
audiobookshelf_1  | /server/libs/njodb/index.js:103
audiobookshelf_1  |         throw error;
audiobookshelf_1  |         ^
audiobookshelf_1  |
audiobookshelf_1  | TypeError: Cannot read properties of undefined (reading 'Markers')
audiobookshelf_1  |     at /server/utils/parsers/parseOverdriveMediaMarkers.js:57:56
audiobookshelf_1  |     at Parser.<anonymous> (/node_modules/xml2js/lib/parser.js:308:18)
audiobookshelf_1  |     at Parser.emit (node:events:527:28)
audiobookshelf_1  |     at SAXParser.onerror (/node_modules/xml2js/lib/parser.js:123:26)
audiobookshelf_1  |     at emit (/node_modules/sax/lib/sax.js:624:35)
audiobookshelf_1  |     at error (/node_modules/sax/lib/sax.js:653:5)
audiobookshelf_1  |     at strictFail (/node_modules/sax/lib/sax.js:677:7)
audiobookshelf_1  |     at SAXParser.write (/node_modules/sax/lib/sax.js:1491:13)
audiobookshelf_1  |     at Parser.exports.Parser.Parser.parseString (/node_modules/xml2js/lib/parser.js:323:31)
audiobookshelf_1  |     at Parser.parseString (/node_modules/xml2js/lib/parser.js:5:59)
audiobookshelf_1  | Emitted 'error' event on Parser instance at:
audiobookshelf_1  |     at Parser.exports.Parser.Parser.parseString (/node_modules/xml2js/lib/parser.js:327:16)
audiobookshelf_1  |     at Parser.parseString (/node_modules/xml2js/lib/parser.js:5:59)
audiobookshelf_1  |     at exports.parseString (/node_modules/xml2js/lib/parser.js:369:19)
audiobookshelf_1  |     at /server/utils/parsers/parseOverdriveMediaMarkers.js:37:5
audiobookshelf_1  |     at Array.forEach (<anonymous>)
audiobookshelf_1  |     at cleanOverdriveMediaMarkers (/server/utils/parsers/parseOverdriveMediaMarkers.js:35:25)
audiobookshelf_1  |     at module.exports.parseOverdriveMediaMarkersAsChapters (/server/utils/parsers/parseOverdriveMediaMarkers.js:144:38)
audiobookshelf_1  |     at Book.setChapters (/server/objects/mediaTypes/Book.js:407:30)
audiobookshelf_1  |     at Book.rebuildTracks (/server/objects/mediaTypes/Book.js:368:10)
audiobookshelf_1  |     at MediaFileScanner.scanMediaFiles (/server/scanner/MediaFileScanner.js:276:29)
cops-bookserver_audiobookshelf_1 exited with code 7
Originally created by @wtanksleyjr on GitHub (Aug 1, 2022). ...as a side note, it would be nice to have more information about what file is causing problems - I've seen a lot of errors, and I've never seen info about what filenames are causing them. ``` audiobookshelf_1 | [2022-08-01 19:41:26] WARN: [abmetadataGenerator] Invalid chapter audiobookshelf_1 | [2022-08-01 19:42:52] INFO: [Book] Overdrive Media Markers and preference found! Using these for chapter definitions audiobookshelf_1 | [2022-08-01 19:42:52] INFO: [parseOverdriveMediaMarkers] Parsing of Overdrive Media Markers started audiobookshelf_1 | [2022-08-01 19:42:52] INFO: [Book] Overdrive Media Markers and preference found! Using these for chapter definitions audiobookshelf_1 | [2022-08-01 19:42:52] INFO: [parseOverdriveMediaMarkers] Parsing of Overdrive Media Markers started audiobookshelf_1 | [2022-08-01 19:42:52] INFO: [Book] Overdrive Media Markers and preference found! Using these for chapter definitions audiobookshelf_1 | [2022-08-01 19:42:52] INFO: [parseOverdriveMediaMarkers] Parsing of Overdrive Media Markers started audiobookshelf_1 | [2022-08-01 19:42:52] INFO: [Book] Overdrive Media Markers and preference found! Using these for chapter definitions audiobookshelf_1 | [2022-08-01 19:42:52] INFO: [parseOverdriveMediaMarkers] Parsing of Overdrive Media Markers started audiobookshelf_1 | [2022-08-01 19:42:52] INFO: [Book] Overdrive Media Markers and preference found! Using these for chapter definitions audiobookshelf_1 | [2022-08-01 19:42:52] INFO: [parseOverdriveMediaMarkers] Parsing of Overdrive Media Markers started audiobookshelf_1 | /server/libs/njodb/index.js:103 audiobookshelf_1 | throw error; audiobookshelf_1 | ^ audiobookshelf_1 | audiobookshelf_1 | TypeError: Cannot read properties of undefined (reading 'Markers') audiobookshelf_1 | at /server/utils/parsers/parseOverdriveMediaMarkers.js:57:56 audiobookshelf_1 | at Parser.<anonymous> (/node_modules/xml2js/lib/parser.js:308:18) audiobookshelf_1 | at Parser.emit (node:events:527:28) audiobookshelf_1 | at SAXParser.onerror (/node_modules/xml2js/lib/parser.js:123:26) audiobookshelf_1 | at emit (/node_modules/sax/lib/sax.js:624:35) audiobookshelf_1 | at error (/node_modules/sax/lib/sax.js:653:5) audiobookshelf_1 | at strictFail (/node_modules/sax/lib/sax.js:677:7) audiobookshelf_1 | at SAXParser.write (/node_modules/sax/lib/sax.js:1491:13) audiobookshelf_1 | at Parser.exports.Parser.Parser.parseString (/node_modules/xml2js/lib/parser.js:323:31) audiobookshelf_1 | at Parser.parseString (/node_modules/xml2js/lib/parser.js:5:59) audiobookshelf_1 | Emitted 'error' event on Parser instance at: audiobookshelf_1 | at Parser.exports.Parser.Parser.parseString (/node_modules/xml2js/lib/parser.js:327:16) audiobookshelf_1 | at Parser.parseString (/node_modules/xml2js/lib/parser.js:5:59) audiobookshelf_1 | at exports.parseString (/node_modules/xml2js/lib/parser.js:369:19) audiobookshelf_1 | at /server/utils/parsers/parseOverdriveMediaMarkers.js:37:5 audiobookshelf_1 | at Array.forEach (<anonymous>) audiobookshelf_1 | at cleanOverdriveMediaMarkers (/server/utils/parsers/parseOverdriveMediaMarkers.js:35:25) audiobookshelf_1 | at module.exports.parseOverdriveMediaMarkersAsChapters (/server/utils/parsers/parseOverdriveMediaMarkers.js:144:38) audiobookshelf_1 | at Book.setChapters (/server/objects/mediaTypes/Book.js:407:30) audiobookshelf_1 | at Book.rebuildTracks (/server/objects/mediaTypes/Book.js:368:10) audiobookshelf_1 | at MediaFileScanner.scanMediaFiles (/server/scanner/MediaFileScanner.js:276:29) cops-bookserver_audiobookshelf_1 exited with code 7 ```
adam closed this issue 2026-04-24 23:13:02 +02:00
Author
Owner

@wtanksleyjr commented on GitHub (Aug 1, 2022):

This is in 2.1.1, book metadata stored in folders, all folders have an OPF file (because I want to control the input).

When I upgraded to the new version, I decided to wipe out my old config and reload everything, so this is a complete from-scratch rescan.

@wtanksleyjr commented on GitHub (Aug 1, 2022): This is in 2.1.1, book metadata stored in folders, all folders have an OPF file (because I want to control the input). When I upgraded to the new version, I decided to wipe out my old config and reload everything, so this is a complete from-scratch rescan.
Author
Owner

@advplyr commented on GitHub (Aug 2, 2022):

I added a check for invalid overdrive chapter data so it doesn't crash the server for the next release.

If you turn on debug logs you may be able to see which book that was.
I try to put the media title or folder path in all error messages, this one was not caught so it wouldn't have it but if you spotted other error messages that don't have the title in it please let me know.

@advplyr commented on GitHub (Aug 2, 2022): I added a check for invalid overdrive chapter data so it doesn't crash the server for the next release. If you turn on debug logs you may be able to see which book that was. I try to put the media title or folder path in all error messages, this one was not caught so it wouldn't have it but if you spotted other error messages that don't have the title in it please let me know.
Author
Owner

@wtanksleyjr commented on GitHub (Aug 3, 2022):

I did see one more without enough information to identify the file (I actually tried, but in the end I gave up):

audiobookshelf_1  | [2022-08-01 18:26:57] ERROR: [xmlToJSON] Error Error: No whitespace between attributes
audiobookshelf_1  | Line: 7
audiobookshelf_1  | Column: 51
audiobookshelf_1  | Char: H
audiobookshelf_1  |     at error (/node_modules/sax/lib/sax.js:651:10)
audiobookshelf_1  |     at strictFail (/node_modules/sax/lib/sax.js:677:7)
audiobookshelf_1  |     at SAXParser.write (/node_modules/sax/lib/sax.js:1395:13)
audiobookshelf_1  |     at Parser.exports.Parser.Parser.parseString (/node_modules/xml2js/lib/parser.js:323:31)
audiobookshelf_1  |     at Parser.parseString (/node_modules/xml2js/lib/parser.js:5:59)
audiobookshelf_1  |     at exports.parseString (/node_modules/xml2js/lib/parser.js:369:19)
audiobookshelf_1  |     at /server/utils/index.js:48:5
audiobookshelf_1  |     at new Promise (<anonymous>)
audiobookshelf_1  |     at xmlToJSON (/server/utils/index.js:47:10)
audiobookshelf_1  |     at module.exports.parseOpfMetadataXML (/server/utils/parsers/parseOpfMetadata.js:104:20)
@wtanksleyjr commented on GitHub (Aug 3, 2022): I did see one more without enough information to identify the file (I actually tried, but in the end I gave up): ``` audiobookshelf_1 | [2022-08-01 18:26:57] ERROR: [xmlToJSON] Error Error: No whitespace between attributes audiobookshelf_1 | Line: 7 audiobookshelf_1 | Column: 51 audiobookshelf_1 | Char: H audiobookshelf_1 | at error (/node_modules/sax/lib/sax.js:651:10) audiobookshelf_1 | at strictFail (/node_modules/sax/lib/sax.js:677:7) audiobookshelf_1 | at SAXParser.write (/node_modules/sax/lib/sax.js:1395:13) audiobookshelf_1 | at Parser.exports.Parser.Parser.parseString (/node_modules/xml2js/lib/parser.js:323:31) audiobookshelf_1 | at Parser.parseString (/node_modules/xml2js/lib/parser.js:5:59) audiobookshelf_1 | at exports.parseString (/node_modules/xml2js/lib/parser.js:369:19) audiobookshelf_1 | at /server/utils/index.js:48:5 audiobookshelf_1 | at new Promise (<anonymous>) audiobookshelf_1 | at xmlToJSON (/server/utils/index.js:47:10) audiobookshelf_1 | at module.exports.parseOpfMetadataXML (/server/utils/parsers/parseOpfMetadata.js:104:20) ```
Author
Owner

@advplyr commented on GitHub (Aug 7, 2022):

Fixed in v2.1.2

@advplyr commented on GitHub (Aug 7, 2022): Fixed in [v2.1.2](https://github.com/advplyr/audiobookshelf/releases/tag/v2.1.2)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#561