Skip to content

[Bug] Youtube playlist subscriptions are shared across all users. #5548

@Fijxu

Description

@Fijxu

Describe the bug

  1. In user one, subscribe to any youtube playlist to save it on /feed/playlists
  2. With user two, visit the same youtube playlist. I will appear as subscribed, making user two unable to unsubscribe or subscribe to that playlist.

Logs

When trying to forcefully subscribe to the playlist, PostgreSQL complains about duplicated pkey

Exception: duplicate key value violates unique constraint "playlists_pkey" (PQ::PQError)
  from lib/pg/src/pq/connection.cr:214:7 in 'handle_error'
  from lib/pg/src/pq/connection.cr:195:9 in 'handle_async_frames'
  from lib/pg/src/pq/connection.cr:173:7 in 'read'
  from lib/pg/src/pq/connection.cr:168:7 in 'read'
  from lib/pg/src/pq/connection.cr:446:31 in 'expect_frame'
  from lib/pg/src/pq/connection.cr:445:5 in 'expect_frame'
  from lib/pg/src/pg/result_set.cr:40:15 in 'move_next'
  from lib/db/src/db/result_set.cr:39:13 in 'perform_exec'
  from lib/db/src/db/statement.cr:93:9 in 'perform_exec_and_release'
  from lib/db/src/db/statement.cr:78:7 in 'exec:args'
  from lib/db/src/db/pool_statement.cr:19:30 in 'exec:args'
  from lib/db/src/db/query_methods.cr:275:7 in 'exec:args'
  from src/invidious/database/playlists.cr:21:5 in 'insert'
  from src/invidious/playlists.cr:284:3 in 'subscribe_playlist'
  from src/invidious/routes/playlists.cr:76:5 in 'subscribe'
  from src/invidious/routing.cr:87:32 in '->'
  from lib/kemal/src/kemal/route.cr:12:26 in '->'
  from src/invidious/helpers/handlers.cr:31:37 in 'process_request'
  from lib/kemal/src/kemal/route_handler.cr:17:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/websocket_handler.cr:13:14 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/filter_handler.cr:22:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:143:5 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:80:12 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:132:5 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from /usr/lib/crystal/http/server/handlers/compress_handler.cr:14:5 in 'call'
  from src/invidious/helpers/handlers.cr:70:5 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/ext/kemal_static_file_handler.cr:162:16 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/exception_handler.cr:8:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/head_request_handler.cr:57:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from /usr/lib/crystal/time.cr:361:5 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/init_handler.cr:15:7 in 'call'
  from /usr/lib/crystal/http/server/request_processor.cr:51:11 in 'process'
  from /usr/lib/crystal/http/server.cr:521:5 in 'handle_client'
  from /usr/lib/crystal/http/server.cr:451:5 in '->'
  from /usr/lib/crystal/fiber.cr:170:11 in 'run'
  from /usr/lib/crystal/fiber.cr:105:3 in '->'
  from ???

Screenshots

2025-11-30.12-40-03.mp4

Additional context

https://git.nadeko.net/Fijxu/invidious/issues/308

It probably needs database changes to be fixed as Youtube and Invidious playlists are stored in the same table. The fix would be making a specific table just for Youtube saved playlists and instead of a single author, it can contain multiple authors (a text array to store multiple users subscribed to the same youtube playlist.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions