[Bug]: Server download URL returning 404 #453

Closed
opened 2026-04-24 23:09:48 +02:00 by adam · 22 comments
Owner

Originally created by @tvories on GitHub (Jun 11, 2022).

Describe the issue

When trying to click the "download" button on a track on the app, a 404 is returned. This is causing crashes in the android app when trying to download local to the phone. Oddly, streaming works fine.

image

result:
Cannot GET /s/item/li_6vmhwv7q2tru6rxiei/Pachinko-Part01.mp3

Steps to reproduce the issue

  1. Use docker hosted audiobookshelf leveraging NFS storage
  2. Scan library files
  3. Open a book and try to download a single file from the book
  4. Receive a 404

Audiobookshelf version

v2.0.21

How are you running audiobookshelf?

Other - Kubernetes

Originally created by @tvories on GitHub (Jun 11, 2022). ### Describe the issue When trying to click the "download" button on a track on the app, a 404 is returned. This is causing crashes in the android app when trying to download local to the phone. Oddly, streaming works fine. ![image](https://user-images.githubusercontent.com/13934524/173171968-77ed5b35-4c2b-4587-8503-da09ac3372d0.png) result: `Cannot GET /s/item/li_6vmhwv7q2tru6rxiei/Pachinko-Part01.mp3` ### Steps to reproduce the issue 1. Use docker hosted audiobookshelf leveraging NFS storage 2. Scan library files 3. Open a book and try to download a single file from the book 4. Receive a 404 ### Audiobookshelf version v2.0.21 ### How are you running audiobookshelf? Other - Kubernetes
adam added the bug label 2026-04-24 23:09:48 +02:00
adam closed this issue 2026-04-24 23:09:49 +02:00
Author
Owner

@jmt-gh commented on GitHub (Jun 11, 2022):

I'm not able to reproduce this.

Can you try this?

  1. Go to the settings gear -> user -> select your user -> API key.
  2. Open a new tab
  3. browse to: http://.com/s/item/li_6vmhwv7q2tru6rxiei/Pachinko-Part01.mp3?token=

If successful, it should start streaming the part directly in your browser (at least that's what I see on firefox). As well, I'm curious -- when you hover over the download icon -- what URL is it directing you to? I'm curious if this is a DNS-esque issue

@jmt-gh commented on GitHub (Jun 11, 2022): I'm not able to reproduce this. Can you try this? 1. Go to the settings gear -> user -> select your user -> API key. 2. Open a new tab 3. browse to: http://<YOURDOMAIN>.com/s/item/li_6vmhwv7q2tru6rxiei/Pachinko-Part01.mp3?token=<YOUR API TOKEN> If successful, it should start streaming the part directly in your browser (at least that's what I see on firefox). As well, I'm curious -- when you hover over the download icon -- what URL is it directing you to? I'm curious if this is a DNS-esque issue
Author
Owner

@helio4k commented on GitHub (Jun 11, 2022):

I am just wondering if you are going through a reveres proxy? I hade a similar experience long time ago but it was due to misconfiguration of my Nginx Proxy manager.

@helio4k commented on GitHub (Jun 11, 2022): I am just wondering if you are going through a reveres proxy? I hade a similar experience long time ago but it was due to misconfiguration of my Nginx Proxy manager.
Author
Owner

@tvories commented on GitHub (Jun 11, 2022):

I am just wondering if you are going through a reveres proxy? I hade a similar experience long time ago but it was due to misconfiguration of my Nginx Proxy manager.

I do run my setup through a reverse proxy, but I tried this with both the reverse proxy and direct. The error I posted above is from the direct connection (no reverse proxy).

@tvories commented on GitHub (Jun 11, 2022): > I am just wondering if you are going through a reveres proxy? I hade a similar experience long time ago but it was due to misconfiguration of my Nginx Proxy manager. I do run my setup through a reverse proxy, but I tried this with both the reverse proxy and direct. The error I posted above is from the direct connection (no reverse proxy).
Author
Owner

@tvories commented on GitHub (Jun 11, 2022):

I'm not able to reproduce this.

Can you try this?

1. Go to the settings gear -> user -> select your user -> API key.

2. Open a new tab

3. browse to: http://.com/s/item/li_6vmhwv7q2tru6rxiei/Pachinko-Part01.mp3?token=

If successful, it should start streaming the part directly in your browser (at least that's what I see on firefox). As well, I'm curious -- when you hover over the download icon -- what URL is it directing you to? I'm curious if this is a DNS-esque issue

I copied that API key manually and replaced the token field with that API token copied from the user account. Same issue. When I right-click the link to the direct file and copy it, it is the same link with the same token.

Direct link URL (no reverse proxy): http://localhost:9911/s/item/li_6vmhwv7q2tru6rxiei/Pachinko-Part01.mp3?token=my-user-token

I also tried creating a new user and tried the same link logged in as the other user. Same result

@tvories commented on GitHub (Jun 11, 2022): > I'm not able to reproduce this. > > Can you try this? > > 1. Go to the settings gear -> user -> select your user -> API key. > > 2. Open a new tab > > 3. browse to: http://.com/s/item/li_6vmhwv7q2tru6rxiei/Pachinko-Part01.mp3?token= > > > If successful, it should start streaming the part directly in your browser (at least that's what I see on firefox). As well, I'm curious -- when you hover over the download icon -- what URL is it directing you to? I'm curious if this is a DNS-esque issue I copied that API key manually and replaced the token field with that API token copied from the user account. Same issue. When I right-click the link to the direct file and copy it, it is the same link with the same token. Direct link URL (no reverse proxy): http://localhost:9911/s/item/li_6vmhwv7q2tru6rxiei/Pachinko-Part01.mp3?token=my-user-token I also tried creating a new user and tried the same link logged in as the other user. Same result
Author
Owner

@tvories commented on GitHub (Jun 11, 2022):

I went back versions until this worked again and the URLs work (with reverse proxy) as of 2.0.14. Something in 2.0.15 breaks these download URLs

I see there are some file permission changes in 2.0.15 that I wonder if they are the culprit.

Updating library folder paths to only set file perms/ownership if creating folder https://github.com/advplyr/audiobookshelf/issues/529

@tvories commented on GitHub (Jun 11, 2022): I went back versions until this worked again and the URLs work (with reverse proxy) as of 2.0.14. Something in 2.0.15 breaks these download URLs I see there are some file permission changes in 2.0.15 that I wonder if they are the culprit. > Updating library folder paths to only set file perms/ownership if creating folder https://github.com/advplyr/audiobookshelf/issues/529
Author
Owner

@tvories commented on GitHub (Jun 11, 2022):

I have a feeling it's related to this: https://github.com/advplyr/audiobookshelf/issues/529

@tvories commented on GitHub (Jun 11, 2022): I have a feeling it's related to this: https://github.com/advplyr/audiobookshelf/issues/529
Author
Owner

@advplyr commented on GitHub (Jun 13, 2022):

Are you able to re-create this issue on the latest release 2.0.21?

@advplyr commented on GitHub (Jun 13, 2022): Are you able to re-create this issue on the latest release 2.0.21?
Author
Owner

@advplyr commented on GitHub (Jun 13, 2022):

I see now that you originally had the issue with the latest version.
The last time the static router was updated was when adding support for downloading single file audiobooks.
Single file audiobooks are handled differently because they are put into the root of the library folder so they don't have a folder. https://github.com/advplyr/audiobookshelf/commit/6cfe583535217a8f4aa31329e57fa01208e282b4

I noticed in your screenshot that you don't have a "Manage Tracks" button.

image

That button is hidden when you have the "isFile" flag set on the audiobook. For some reason that flag was set on your audiobook.
Did you originally have the audio file inside the library folder root then moved it into a subfolder?

@advplyr commented on GitHub (Jun 13, 2022): I see now that you originally had the issue with the latest version. The last time the static router was updated was when adding support for downloading single file audiobooks. Single file audiobooks are handled differently because they are put into the root of the library folder so they don't have a folder. https://github.com/advplyr/audiobookshelf/commit/6cfe583535217a8f4aa31329e57fa01208e282b4 I noticed in your screenshot that you don't have a "Manage Tracks" button. ![image](https://user-images.githubusercontent.com/67830747/173256310-ae9910ed-71d0-4c2f-bf0d-4d7037e13b23.png) That button is hidden when you have the "isFile" flag set on the audiobook. For some reason that flag was set on your audiobook. Did you originally have the audio file inside the library folder root then moved it into a subfolder?
Author
Owner

@tvories commented on GitHub (Jun 13, 2022):

I have gone through a few different iterations of my library. Originally, my books were mounted to: /audiobooks. Then I moved to /media/books. When I was testing fixes, I thought maybe it was related to the directory level, so when I was doing this troubleshooting, I went back to /audiobooks. 2.0.21 did not work with /audiobooks or /media/books. I am back on 2.0.14 and downloads are working great.

@tvories commented on GitHub (Jun 13, 2022): I have gone through a few different iterations of my library. Originally, my books were mounted to: `/audiobooks`. Then I moved to `/media/books`. When I was testing fixes, I thought maybe it was related to the directory level, so when I was doing this troubleshooting, I went back to `/audiobooks`. 2.0.21 did not work with /audiobooks or /media/books. I am back on 2.0.14 and downloads are working great.
Author
Owner

@advplyr commented on GitHub (Jun 13, 2022):

It's working in 2.0.14 because single file audiobooks weren't implemented yet. Somehow your audiobook was flagged as a single file audiobook.
Until we can get reproducible steps the workaround will be to remove the library item then scan the library again.

@advplyr commented on GitHub (Jun 13, 2022): It's working in 2.0.14 because single file audiobooks weren't implemented yet. Somehow your audiobook was flagged as a single file audiobook. Until we can get reproducible steps the workaround will be to remove the library item then scan the library again.
Author
Owner

@tvories commented on GitHub (Jun 13, 2022):

In the process of troubleshooting, I have destroyed and re-created my library many times. Every item in my library is unable to be downloaded because of the 404.

I'll try removing the item and re-scanning after going to 2.0.21

@tvories commented on GitHub (Jun 13, 2022): In the process of troubleshooting, I have destroyed and re-created my library many times. Every item in my library is unable to be downloaded because of the 404. I'll try removing the item and re-scanning after going to 2.0.21
Author
Owner

@advplyr commented on GitHub (Jun 13, 2022):

If you don't see the "Manage Tracks" button on the tracks dropdown of the library item then you won't be able to download.

@advplyr commented on GitHub (Jun 13, 2022): If you don't see the "Manage Tracks" button on the tracks dropdown of the library item then you won't be able to download.
Author
Owner

@tvories commented on GitHub (Jun 13, 2022):

I updated to 2.0.21 and removed the library item. I re-scanned, went to the library item, and same results - the book is not recognized as a multi-file audiobook.

Is there something in the logs I can look for when it does a scan to see why it's not getting the correct type of book?

2022-06-13 15:23:26

DEBUG

[fileUtils] Ignoring path has . "Jim Butcher/.DS_Store"

2022-06-13 15:23:27

DEBUG

[AudioFileScanner] Smart track order for "Min Jin Lee" using track key trackNumFromFilename

2022-06-13 15:23:27

DEBUG

[BookMetadata] Key updated title Pachinko

2022-06-13 15:23:27

DEBUG

[BookMetadata] Key updated authors [object Object]

2022-06-13 15:23:27

DEBUG

[BookMetadata] Key updated genres Fiction,Literature

2022-06-13 15:23:27

DEBUG

[BookMetadata] Key updated publisher Blackstone Audio, Inc.

2022-06-13 15:23:27

DEBUG

[BookMetadata] Key updated language English

2022-06-13 15:23:28

DEBUG

[LibraryItem] Success saving abmetadata to "/metadata/items/li_38o3u7gnz1hdn767qz/metadata.abs"

2022-06-13 15:23:28

DEBUG

[DB] Library Items inserted 1

2022-06-13 15:23:28

INFO

[Scanner] Library scan lscan_1yxlhne7hot71x8dog completed in 0:10.0 | 1 Added | 0 Updated | 0 Missing

2022-06-13 15:23:28

INFO

[LibraryController] Scan complete

2022-06-13 15:23:28

INFO

[LibraryScan] Scan log saved "/metadata/logs/scans/2022-06-13_lscan_1yxlhne7hot71x8dog.txt"
@tvories commented on GitHub (Jun 13, 2022): I updated to 2.0.21 and removed the library item. I re-scanned, went to the library item, and same results - the book is not recognized as a multi-file audiobook. Is there something in the logs I can look for when it does a scan to see why it's not getting the correct type of book? ``` 2022-06-13 15:23:26 DEBUG [fileUtils] Ignoring path has . "Jim Butcher/.DS_Store" 2022-06-13 15:23:27 DEBUG [AudioFileScanner] Smart track order for "Min Jin Lee" using track key trackNumFromFilename 2022-06-13 15:23:27 DEBUG [BookMetadata] Key updated title Pachinko 2022-06-13 15:23:27 DEBUG [BookMetadata] Key updated authors [object Object] 2022-06-13 15:23:27 DEBUG [BookMetadata] Key updated genres Fiction,Literature 2022-06-13 15:23:27 DEBUG [BookMetadata] Key updated publisher Blackstone Audio, Inc. 2022-06-13 15:23:27 DEBUG [BookMetadata] Key updated language English 2022-06-13 15:23:28 DEBUG [LibraryItem] Success saving abmetadata to "/metadata/items/li_38o3u7gnz1hdn767qz/metadata.abs" 2022-06-13 15:23:28 DEBUG [DB] Library Items inserted 1 2022-06-13 15:23:28 INFO [Scanner] Library scan lscan_1yxlhne7hot71x8dog completed in 0:10.0 | 1 Added | 0 Updated | 0 Missing 2022-06-13 15:23:28 INFO [LibraryController] Scan complete 2022-06-13 15:23:28 INFO [LibraryScan] Scan log saved "/metadata/logs/scans/2022-06-13_lscan_1yxlhne7hot71x8dog.txt" ```
Author
Owner

@tvories commented on GitHub (Jun 14, 2022):

This definitely has something to do with the way my NFS volume is mounted. I mounted a direct file to my deployment, copied the same Pachinko book, and it comes up with the "Manage Tracks" option. I will mess around with NFS permissions a bit and see if I can determine which ones are throwing things off

Update:
I tried a few different NFS options and nothing made a difference. I don't think it's a permissions issue because I can create and delete directories and books from the container. I can also download any single file (top-level) books. Also, the same NFS mount works fine with 2.0.14

I think you're onto something about it being the scanner. I just don't know why my NFS storage is not scanning correctly.

Can anyone else with NFS storage chime in about whether or not theirs is working?

@tvories commented on GitHub (Jun 14, 2022): This definitely has something to do with the way my NFS volume is mounted. I mounted a direct file to my deployment, copied the same Pachinko book, and it comes up with the "Manage Tracks" option. I will mess around with NFS permissions a bit and see if I can determine which ones are throwing things off Update: I tried a few different NFS options and nothing made a difference. I don't think it's a permissions issue because I can create and delete directories and books from the container. I can also download any single file (top-level) books. Also, the same NFS mount works fine with 2.0.14 I think you're onto something about it being the scanner. I just don't know why my NFS storage is not scanning correctly. Can anyone else with NFS storage chime in about whether or not theirs is working?
Author
Owner

@advplyr commented on GitHub (Jun 17, 2022):

I'm not sure this is related to NFS, this could be a bug with how the scanner detects single file audiobooks in the library folder root.
What is the folder path and the library item path? I can re-create your directory structure for that audiobook that is scanned in wrong to test it.

@advplyr commented on GitHub (Jun 17, 2022): I'm not sure this is related to NFS, this could be a bug with how the scanner detects single file audiobooks in the library folder root. What is the folder path and the library item path? I can re-create your directory structure for that audiobook that is scanned in wrong to test it.
Author
Owner

@tvories commented on GitHub (Jun 17, 2022):

Currently, I have my audiobooks mounted to /audiobooks. Here is the structure:

/audiobooks/Min Jin Lee - Pachinko/
├── Pachinko-Cover.jpg
├── Pachinko-Part01.mp3
├── Pachinko-Part02.mp3
├── Pachinko-Part03.mp3
├── Pachinko-Part04.mp3
├── Pachinko-Part05.mp3
├── Pachinko-Part06.mp3
├── Pachinko-Part07.mp3
├── Pachinko-Part08.mp3
├── Pachinko-Part09.mp3
├── Pachinko-Part10.mp3
├── Pachinko-Part11.mp3
├── Pachinko-Part12.mp3
├── Pachinko-Part13.mp3
├── Pachinko-Part14.mp3
├── Pachinko-Part15.mp3
├── Pachinko-Part16.mp3
└── Pachinko.jpg

0 directories, 18 files
@tvories commented on GitHub (Jun 17, 2022): Currently, I have my audiobooks mounted to /audiobooks. Here is the structure: ```tree /audiobooks/Min Jin Lee - Pachinko/ ├── Pachinko-Cover.jpg ├── Pachinko-Part01.mp3 ├── Pachinko-Part02.mp3 ├── Pachinko-Part03.mp3 ├── Pachinko-Part04.mp3 ├── Pachinko-Part05.mp3 ├── Pachinko-Part06.mp3 ├── Pachinko-Part07.mp3 ├── Pachinko-Part08.mp3 ├── Pachinko-Part09.mp3 ├── Pachinko-Part10.mp3 ├── Pachinko-Part11.mp3 ├── Pachinko-Part12.mp3 ├── Pachinko-Part13.mp3 ├── Pachinko-Part14.mp3 ├── Pachinko-Part15.mp3 ├── Pachinko-Part16.mp3 └── Pachinko.jpg 0 directories, 18 files ```
Author
Owner

@Thovi98 commented on GitHub (Jun 22, 2022):

I’ve same issue, although I didn’t have it a few released before (I discovered it in 2.0.20).
I can play any audiobook, but cannot download them.
I don’t know how I can help resolving this issue ?

@Thovi98 commented on GitHub (Jun 22, 2022): I’ve same issue, although I didn’t have it a few released before (I discovered it in 2.0.20). I can play any audiobook, but cannot download them. I don’t know how I can help resolving this issue ?
Author
Owner

@tvories commented on GitHub (Jun 22, 2022):

@Thovi98 are you using NFS for storage?

@tvories commented on GitHub (Jun 22, 2022): @Thovi98 are you using NFS for storage?
Author
Owner

@Thovi98 commented on GitHub (Jun 22, 2022):

I don’t think so, at least I don’t have nfs- related packages installed and I don’t know understand exactly what it does, so I don’t think (I’m still a newbie) 😁

Edit : I’m self-hosting on a Yunohost debian 11 based system, thanks to this package, maybe it will help debugging : https://github.com/YunoHost-Apps/audiobookshelf_ynh/pull/13

@Thovi98 commented on GitHub (Jun 22, 2022): I don’t think so, at least I don’t have nfs- related packages installed and I don’t know understand exactly what it does, so I don’t think (I’m still a newbie) 😁 Edit : I’m self-hosting on a Yunohost debian 11 based system, thanks to this package, maybe it will help debugging : https://github.com/YunoHost-Apps/audiobookshelf_ynh/pull/13
Author
Owner

@simonbh commented on GitHub (Jul 11, 2022):

I experienced this issue for one of my audiobooks. Single file download and playback returned a HTTP 404 message.
Running version 2.0.23 via docker-compose. My audiobooks are stored on a TrueNAS host via NFS.

I corrected the issue by changing the "&" character to "and" in the audiobook file name and author directory.
For example:
From:
/audiobooks/James Smith & Kevin Smith/Great Audiobook by James Smith & Kevin Smith.mp3
To:
/audiobooks/James Smith and Kevin Smith/Great Audiobook by James Smith and Kevin Smith.mp3

I then re-scanned my library, The new directory/file was then added. I then manually removed the old entry. After this, download and playback worked as expected.

@simonbh commented on GitHub (Jul 11, 2022): I experienced this issue for one of my audiobooks. Single file download and playback returned a HTTP 404 message. Running version 2.0.23 via docker-compose. My audiobooks are stored on a TrueNAS host via NFS. I corrected the issue by changing the "&" character to "and" in the audiobook file name and author directory. For example: From: /audiobooks/James Smith & Kevin Smith/Great Audiobook by James Smith & Kevin Smith.mp3 To: /audiobooks/James Smith and Kevin Smith/Great Audiobook by James Smith and Kevin Smith.mp3 I then re-scanned my library, The new directory/file was then added. I then manually removed the old entry. After this, download and playback worked as expected.
Author
Owner

@advplyr commented on GitHub (Jul 12, 2022):

Thanks for the breakdown. I don't believe the "&" had anything to do with the error here, I think in your case renaming the folder had the scanner pick it up as a new library item.

This issue was fixed in that last commit but just hasn't made it into a release yet.

@advplyr commented on GitHub (Jul 12, 2022): Thanks for the breakdown. I don't believe the "&" had anything to do with the error here, I think in your case renaming the folder had the scanner pick it up as a new library item. This issue was fixed in that last commit but just hasn't made it into a release yet.
Author
Owner

@advplyr commented on GitHub (Jul 15, 2022):

Fixed in v2.0.24

For anyone having this issue run a regular scan on the library with the latest version and it will correct those library items.

@advplyr commented on GitHub (Jul 15, 2022): Fixed in [v2.0.24](https://github.com/advplyr/audiobookshelf/releases/tag/v2.0.24) For anyone having this issue run a regular scan on the library with the latest version and it will correct those library items.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#453