Self-hosted Cobalt returns files with 0 bytes from YouTube #940

Closed
opened 2025-11-09 10:02:20 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @Chakalaka11 on GitHub (Aug 26, 2025).

problem description

Title.
Any file that I'm trying to download from tunnel returns with 0 bytes for some reason
Even in non-docker instance that I've launched this issue persists
Is there any verbose logs that I could check or configuration that I've missed?

your instance configuration

services:
    cobalt-api:
        image: ghcr.io/imputnet/cobalt:10

        init: true
        read_only: true
        restart: unless-stopped
        container_name: cobalt-api

        ports:
            - 9000:9000/tcp
            # if you use a reverse proxy (such as nginx),
            # uncomment the next line and remove the one above (9000:9000/tcp):
            # - 127.0.0.1:9000:9000

        environment:
            # replace https://api.url.example/ with your instance's url
            # or else tunneling functionality won't work properly
            API_URL: "http://localhost:9000/"

            # if you want to use cookies for fetching data from services,
            # uncomment the next line & volumes section
            # COOKIE_PATH: "/cookies.json"

            # it's recommended to configure bot protection or api keys if the instance is public,
            # see /docs/protect-an-instance.md for more info

            # see /docs/run-an-instance.md for more variables that you can use here

        labels:
            - com.centurylinklabs.watchtower.scope=cobalt

        # uncomment only if you use the COOKIE_PATH variable
        # volumes:
            # - ./cookies.json:/cookies.json

    # watchtower updates the cobalt image automatically
    watchtower:
        image: ghcr.io/containrrr/watchtower
        restart: unless-stopped
        command: --cleanup --scope cobalt --interval 900 --include-restarting
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
Originally created by @Chakalaka11 on GitHub (Aug 26, 2025). ### problem description Title. Any file that I'm trying to download from tunnel returns with 0 bytes for some reason Even in non-docker instance that I've launched this issue persists Is there any verbose logs that I could check or configuration that I've missed? ### your instance configuration ```shell services: cobalt-api: image: ghcr.io/imputnet/cobalt:10 init: true read_only: true restart: unless-stopped container_name: cobalt-api ports: - 9000:9000/tcp # if you use a reverse proxy (such as nginx), # uncomment the next line and remove the one above (9000:9000/tcp): # - 127.0.0.1:9000:9000 environment: # replace https://api.url.example/ with your instance's url # or else tunneling functionality won't work properly API_URL: "http://localhost:9000/" # if you want to use cookies for fetching data from services, # uncomment the next line & volumes section # COOKIE_PATH: "/cookies.json" # it's recommended to configure bot protection or api keys if the instance is public, # see /docs/protect-an-instance.md for more info # see /docs/run-an-instance.md for more variables that you can use here labels: - com.centurylinklabs.watchtower.scope=cobalt # uncomment only if you use the COOKIE_PATH variable # volumes: # - ./cookies.json:/cookies.json # watchtower updates the cobalt image automatically watchtower: image: ghcr.io/containrrr/watchtower restart: unless-stopped command: --cleanup --scope cobalt --interval 900 --include-restarting volumes: - /var/run/docker.sock:/var/run/docker.sock ```
GiteaMirror added the instance hosting help label 2025-11-09 10:02:20 -06:00
Author
Owner

@Renaud11232 commented on GitHub (Sep 6, 2025):

I'm currently facing the same problem where sometimes, cobalt returns 0byte-length responses.

However this does not happen every time :

  • Sometimes a given video will successfully download, then later the same video will result in a 0byte file
  • While it does return 0-byte files for some videos, some others will still work.

For instance while writing this comment, the following video will result in a 0-byte file :

curl --request POST --header "Accept: application/json" --header "Content-Type: application/json" --data '{"url": "https://music.youtube.com/watch?v=PVZNdRBJ2xY&si=EiaRgjmIC3MKDLpx", "audioFormat": "wav", "downloadMode": "audio"}' http://cobalt:9000

This returns something like :

{"status":"tunnel","url":"http://cobalt:9000/tunnel?id=XXX....","filename":"One Chance (feat. Marlhy) - Knock2.wav"}

Then trying to download the file with :

wget "http://cobalt:9000/tunnel?id=XXX...." -O test.wav

This will return an HTTP OK 200, but the download file will be empty :

ls -lah test.wav
-rw-r--r-- 1 root root 0 Sep  6 09:56 test.wav

The exact same commands did work ~3 minutes later.

I hope this helps

@Renaud11232 commented on GitHub (Sep 6, 2025): I'm currently facing the same problem where sometimes, cobalt returns 0byte-length responses. However this does not happen every time : * Sometimes a given video will successfully download, then later the same video will result in a 0byte file * While it does return 0-byte files for some videos, some others will still work. For instance while writing this comment, the following video will result in a 0-byte file : ```bash curl --request POST --header "Accept: application/json" --header "Content-Type: application/json" --data '{"url": "https://music.youtube.com/watch?v=PVZNdRBJ2xY&si=EiaRgjmIC3MKDLpx", "audioFormat": "wav", "downloadMode": "audio"}' http://cobalt:9000 ``` This returns something like : ```json {"status":"tunnel","url":"http://cobalt:9000/tunnel?id=XXX....","filename":"One Chance (feat. Marlhy) - Knock2.wav"} ``` Then trying to download the file with : ```bash wget "http://cobalt:9000/tunnel?id=XXX...." -O test.wav ``` This will return an HTTP OK 200, but the download file will be empty : ```bash ls -lah test.wav ``` ``` -rw-r--r-- 1 root root 0 Sep 6 09:56 test.wav ``` The exact same commands did work ~3 minutes later. I hope this helps
Author
Owner

@wukko commented on GitHub (Sep 6, 2025):

your server's ip address got temporarily blocked by googlevideo, you'll have to either wait or use a fresh ip address to fix this. cobalt's source code doesn't have anything to do with this, unfortunately

@wukko commented on GitHub (Sep 6, 2025): your server's ip address got temporarily blocked by googlevideo, you'll have to either wait or use a fresh ip address to fix this. cobalt's source code doesn't have anything to do with this, unfortunately
Author
Owner

@Renaud11232 commented on GitHub (Sep 6, 2025):

Thank you for the clarification.

As a suggestion, would it be possible to add an error code / message for such cases ?
Similarly to age restricted videos, login required...

Thanks

@Renaud11232 commented on GitHub (Sep 6, 2025): Thank you for the clarification. As a suggestion, would it be possible to add an error code / message for such cases ? Similarly to age restricted videos, login required... Thanks
Author
Owner

@wukko commented on GitHub (Sep 6, 2025):

it can't be detected before starting the file stream, but cobalt's tunnels do return HTTP codes to indicate errors

@wukko commented on GitHub (Sep 6, 2025): it can't be detected before starting the file stream, but cobalt's tunnels do return HTTP codes to indicate errors
Sign in to join this conversation.