[Bug]: Malformed request in Custom Metadata Provider crashes the ABS server #2244

Closed
opened 2026-04-25 00:05:24 +02:00 by adam · 1 comment
Owner

Originally created by @valdearg on GitHub (Sep 8, 2024).

What happened?

Taking a look at making a custom metadata provider per the docs.

When testing searching, it crashed the server with the following message:

[2024-09-08 16:01:36.738] FATAL: [Server] Unhandled rejection: Error: Custom provider returned malformed response, promise: Promise {

  <rejected> Error: Custom provider returned malformed response

      at CustomProviderAdapter.search (/server/providers/CustomProviderAdapter.js:65:13)

      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

      at async BookFinder.getCustomProviderResults (/server/finders/BookFinder.js:205:19)

      at async ApiRouter.findBooks (/server/controllers/SearchController.js:38:21)

} (Server.js:185)

What did you expect to happen?

When searching, I'd just expect it to give a "error when searching", maybe a reason in the debug logs?

Steps to reproduce the issue

Haven't published the API site externally just yet, but the response might be helpful, I'm also fully aware that this probably isn't the correct response type.

[
    {
        "title": "666 Charing Cross Road",
        "subtitle": null,
        "authors": "Paul Magrs",
        "series": [
            "Iris Wildthyme and Friends #666 Charing Cross Road"
        ],
        "genres": [
            "Audio Drama"
        ],
        "publishedYear": "2021",
        "publishedDate": null,
        "publisher": "Big Finish",
        "description": "New Yorker Elizabeth Bathory loves books, and when she is given the address of a very special bookshop in London, she writes to order herself a selection of paranormal romances and vampire fiction.\n\nBut one book has a mysterious dark bloodstain marking the pages, and soon, New York finds itself infected with vampires.\n\nOnly the Scottish Bride, an ancient effigy from the basement of the New York Museum of Outsider Art, and her new friends can stop it...\n\n666 Charing Cross Road was first published by Headline Review in 2012 and is still available as a paperback and ebook.",
        "isbn": "978-1-83868-575-1",
        "asin": null,
        "language": null,
        "explicit": false,
        "abridged": false,
        "cover": "https://www.bigfinish.com/image/release/2395/"
    }
]

This is when calling the API with: /big-finish/search?mediaType=book&query=7.1+.+Doctor+Who%3A+The+Ark&author=John+Lucarotti

EDIT: I've noticed that this is simply because it's expecting the results to come back in a "matches" node.

E.g.

{
    "matches": [
        {
            "title": "666 Charing Cross Road"
        }
    ]
}

Audiobookshelf version

v2.13.3

How are you running audiobookshelf?

Docker

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

No response

Additional Notes

No response

Originally created by @valdearg on GitHub (Sep 8, 2024). ### What happened? Taking a look at making a custom metadata provider per the docs. When testing searching, it crashed the server with the following message: ``` [2024-09-08 16:01:36.738] FATAL: [Server] Unhandled rejection: Error: Custom provider returned malformed response, promise: Promise { <rejected> Error: Custom provider returned malformed response at CustomProviderAdapter.search (/server/providers/CustomProviderAdapter.js:65:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async BookFinder.getCustomProviderResults (/server/finders/BookFinder.js:205:19) at async ApiRouter.findBooks (/server/controllers/SearchController.js:38:21) } (Server.js:185) ``` ### What did you expect to happen? When searching, I'd just expect it to give a "error when searching", maybe a reason in the debug logs? ### Steps to reproduce the issue Haven't published the API site externally just yet, but the response might be helpful, I'm also fully aware that this probably isn't the correct response type. ``` [ { "title": "666 Charing Cross Road", "subtitle": null, "authors": "Paul Magrs", "series": [ "Iris Wildthyme and Friends #666 Charing Cross Road" ], "genres": [ "Audio Drama" ], "publishedYear": "2021", "publishedDate": null, "publisher": "Big Finish", "description": "New Yorker Elizabeth Bathory loves books, and when she is given the address of a very special bookshop in London, she writes to order herself a selection of paranormal romances and vampire fiction.\n\nBut one book has a mysterious dark bloodstain marking the pages, and soon, New York finds itself infected with vampires.\n\nOnly the Scottish Bride, an ancient effigy from the basement of the New York Museum of Outsider Art, and her new friends can stop it...\n\n666 Charing Cross Road was first published by Headline Review in 2012 and is still available as a paperback and ebook.", "isbn": "978-1-83868-575-1", "asin": null, "language": null, "explicit": false, "abridged": false, "cover": "https://www.bigfinish.com/image/release/2395/" } ] ``` This is when calling the API with: /big-finish/search?mediaType=book&query=7.1+.+Doctor+Who%3A+The+Ark&author=John+Lucarotti EDIT: I've noticed that this is simply because it's expecting the results to come back in a "matches" node. E.g. ``` { "matches": [ { "title": "666 Charing Cross Road" } ] } ``` ### Audiobookshelf version v2.13.3 ### How are you running audiobookshelf? Docker ### 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 _No response_ ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:05:24 +02:00
adam closed this issue 2026-04-25 00:05:24 +02:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 9, 2024):

Fixed in v2.13.4.

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

No dependencies set.

Reference: starred/audiobookshelf#2244