[Bug]: OPF file without narrator generates an ABS file that crashes reader #1002

Closed
opened 2026-04-24 23:28:48 +02:00 by adam · 1 comment
Owner

Originally created by @wtanksleyjr on GitHub (Mar 4, 2023).

Describe the issue

I generated an OPF file from data that didn't include narrator info; I think it's a perfectly valid OPF (although I could be wrong), just didn't have a creator element with "nrt" role. It was in a book that was already loaded (on 03/01, about 3 days ago). When I copied it in and did a "Re-Scan" on the drop-down menu for that book, I got an error popup (failed to rescan). When I checked the logs, I saw this:

audiobookshelf_1  | [2023-03-03 23:33:41] INFO: [Scanner] Scanning Library Item "Very Important Corpses"
audiobookshelf_1  | [2023-03-03 23:33:41] DEBUG: [fileUtils] Ignoring path has . ".metadata.opf.swp" (fileUtils.js:145)
audiobookshelf_1  | [2023-03-03 23:33:41] DEBUG: [Book] Found metadata.abs file for "Very Important Corpses" (Book.js:253)
audiobookshelf_1  | [2023-03-03 23:33:41] DEBUG: [Book] "Very Important Corpses" changes found in metadata.abs file {
audiobookshelf_1  |   metadata: { genres: [ 'Mystery', 'Thriller & Suspense', 'Mystery' ] }
audiobookshelf_1  | } (Book.js:257)
audiobookshelf_1  | /server/libs/njodb/index.js:103
audiobookshelf_1  |         throw error;
audiobookshelf_1  |         ^
audiobookshelf_1  |
audiobookshelf_1  | TypeError: Cannot read properties of null (reading 'length')
audiobookshelf_1  |     at fetchNarrators (/server/utils/parsers/parseOpfMetadata.js:114:56)
audiobookshelf_1  |     at module.exports.parseOpfMetadataXML (/server/utils/parsers/parseOpfMetadata.js:163:22)
audiobookshelf_1  |     at async Book.syncMetadataFiles (/server/objects/mediaTypes/Book.js:276:29)
audiobookshelf_1  |     at async LibraryItem.syncFiles (/server/objects/LibraryItem.js:455:11)
audiobookshelf_1  |     at async Scanner.scanLibraryItem (/server/scanner/Scanner.js:81:9)
audiobookshelf_1  |     at async ApiRouter.scan (/server/controllers/LibraryItemController.js:404:18)

Interestingly, there are no log entries mentioning the metadata.opf file itself (unless that "ignoring" message about vim's temp file is relevant).

The OPF file is:
metadata.opf.txt
The ABS file is:
metadata.abs.txt

Steps to reproduce the issue

  1. Add a book, do a Match.
  2. Move that OPF file into book's folder.
  3. Re-scan from Library. Observe error banner.
  4. I saw a complete application crash and restart.

Audiobookshelf version

2.2.15

How are you running audiobookshelf?

Docker

Originally created by @wtanksleyjr on GitHub (Mar 4, 2023). ### Describe the issue I generated an OPF file from data that didn't include narrator info; I think it's a perfectly valid OPF (although I could be wrong), just didn't have a creator element with "nrt" role. It was in a book that was already loaded (on 03/01, about 3 days ago). When I copied it in and did a "Re-Scan" on the drop-down menu for that book, I got an error popup (failed to rescan). When I checked the logs, I saw this: ``` audiobookshelf_1 | [2023-03-03 23:33:41] INFO: [Scanner] Scanning Library Item "Very Important Corpses" audiobookshelf_1 | [2023-03-03 23:33:41] DEBUG: [fileUtils] Ignoring path has . ".metadata.opf.swp" (fileUtils.js:145) audiobookshelf_1 | [2023-03-03 23:33:41] DEBUG: [Book] Found metadata.abs file for "Very Important Corpses" (Book.js:253) audiobookshelf_1 | [2023-03-03 23:33:41] DEBUG: [Book] "Very Important Corpses" changes found in metadata.abs file { audiobookshelf_1 | metadata: { genres: [ 'Mystery', 'Thriller & Suspense', 'Mystery' ] } audiobookshelf_1 | } (Book.js:257) audiobookshelf_1 | /server/libs/njodb/index.js:103 audiobookshelf_1 | throw error; audiobookshelf_1 | ^ audiobookshelf_1 | audiobookshelf_1 | TypeError: Cannot read properties of null (reading 'length') audiobookshelf_1 | at fetchNarrators (/server/utils/parsers/parseOpfMetadata.js:114:56) audiobookshelf_1 | at module.exports.parseOpfMetadataXML (/server/utils/parsers/parseOpfMetadata.js:163:22) audiobookshelf_1 | at async Book.syncMetadataFiles (/server/objects/mediaTypes/Book.js:276:29) audiobookshelf_1 | at async LibraryItem.syncFiles (/server/objects/LibraryItem.js:455:11) audiobookshelf_1 | at async Scanner.scanLibraryItem (/server/scanner/Scanner.js:81:9) audiobookshelf_1 | at async ApiRouter.scan (/server/controllers/LibraryItemController.js:404:18) ``` Interestingly, there are no log entries mentioning the metadata.opf file itself (unless that "ignoring" message about vim's temp file is relevant). The OPF file is: [metadata.opf.txt](https://github.com/advplyr/audiobookshelf/files/10886978/metadata.opf.txt) The ABS file is: [metadata.abs.txt](https://github.com/advplyr/audiobookshelf/files/10886979/metadata.abs.txt) ### Steps to reproduce the issue 1. Add a book, do a Match. 2. Move that OPF file into book's folder. 3. Re-scan from Library. Observe error banner. 4. I saw a complete application crash and restart. ### Audiobookshelf version 2.2.15 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:28:48 +02:00
adam closed this issue 2026-04-24 23:28:48 +02:00
Author
Owner

@advplyr commented on GitHub (Mar 6, 2023):

Fixed in v2.2.16

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

No dependencies set.

Reference: starred/audiobookshelf#1002