[Bug]: Crash occurs when quick matching a certain book #672

Closed
opened 2026-04-24 23:16:37 +02:00 by adam · 2 comments
Owner

Originally created by @Undergrid on GitHub (Oct 3, 2022).

Describe the issue

Using the latests 2.2.0 release, I noticed the server disconnecting from the client when attempting to quick match certain books. The servers crashes with the following error:

[2022-10-03 01:15:56] DEBUG: [Audible] ASIN url: https://api.audnex.us/books/B00O4FFPWU
C:\Dev\audiobookshelf\server\libs\njodb\index.js:103
        throw error;
        ^

TypeError: Cannot read properties of undefined (reading 'split')
    at Scanner.quickMatchBookBuildUpdatePayload (C:\Dev\audiobookshelf\server\scanner\Scanner.js:822:45)
    at Scanner.quickMatchLibraryItem (C:\Dev\audiobookshelf\server\scanner\Scanner.js:713:34)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ApiRouter.batchQuickMatch (C:\Dev\audiobookshelf\server\controllers\LibraryItemController.js:328:25)

The code in question (line 822 is the else clause)

          if ((!libraryItem.media.tags.length || options.overrideDetails)) {
            var tagsArray = []
            if (Array.isArray(matchData[key])) tagsArray = [...matchData[key]]
            else tagsArray = tagsArray[key].split(',').map(v => v.trim()).filter(v => !!v)
            updatePayload[key] = tagsArray
          }

Obviously tagsArray[key] is null when the else clause executes because it's just been initialised a few lines above, but I'm not sure if the tagsArray[key] should actually be referencing another variable or if the else case can be removed.

Steps to reproduce the issue

  1. Quick match a particular book with the overwrite details turned on. I'm not sure why this file is causing the issue, just that it's repeatable.

Audiobookshelf version

2.2.0

How are you running audiobookshelf?

Docker

Originally created by @Undergrid on GitHub (Oct 3, 2022). ### Describe the issue Using the latests 2.2.0 release, I noticed the server disconnecting from the client when attempting to quick match certain books. The servers crashes with the following error: ``` [2022-10-03 01:15:56] DEBUG: [Audible] ASIN url: https://api.audnex.us/books/B00O4FFPWU C:\Dev\audiobookshelf\server\libs\njodb\index.js:103 throw error; ^ TypeError: Cannot read properties of undefined (reading 'split') at Scanner.quickMatchBookBuildUpdatePayload (C:\Dev\audiobookshelf\server\scanner\Scanner.js:822:45) at Scanner.quickMatchLibraryItem (C:\Dev\audiobookshelf\server\scanner\Scanner.js:713:34) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ApiRouter.batchQuickMatch (C:\Dev\audiobookshelf\server\controllers\LibraryItemController.js:328:25) ``` The code in question (line 822 is the else clause) ``` if ((!libraryItem.media.tags.length || options.overrideDetails)) { var tagsArray = [] if (Array.isArray(matchData[key])) tagsArray = [...matchData[key]] else tagsArray = tagsArray[key].split(',').map(v => v.trim()).filter(v => !!v) updatePayload[key] = tagsArray } ``` Obviously tagsArray[key] is null when the else clause executes because it's just been initialised a few lines above, but I'm not sure if the tagsArray[key] should actually be referencing another variable or if the else case can be removed. ### Steps to reproduce the issue 1. Quick match a particular book with the overwrite details turned on. I'm not sure why this file is causing the issue, just that it's repeatable. ### Audiobookshelf version 2.2.0 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:16:37 +02:00
adam closed this issue 2026-04-24 23:16:37 +02:00
Author
Owner

@Undergrid commented on GitHub (Oct 3, 2022):

After looking at the code again, I think it should be matchData[key] rather than tagsArray[key] so I've opened PR #1031 which appears to fix the issue.

@Undergrid commented on GitHub (Oct 3, 2022): After looking at the code again, I think it should be matchData[key] rather than tagsArray[key] so I've opened PR #1031 which appears to fix the issue.
Author
Owner

@advplyr commented on GitHub (Oct 9, 2022):

Fixed in v2.2.1

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

No dependencies set.

Reference: starred/audiobookshelf#672