Waterboy1602 / Addarr

Telegram Bot for adding series/movies to Sonarr/Radarr or for changing the download speed of Transmission/Sabnzbd
MIT License
229 stars 55 forks source link

Container failing when trying to add a movie #155

Closed heisenberg2980 closed 6 months ago

heisenberg2980 commented 6 months ago

Recently the container has started failing when trying to search for a movie (it is working for series though). This is the error in the log:

addarr  | 2024-03-06 11:04:16,768 - addarr.radarr - INFO - http://192.168.0.208:7878/api/v3/movie/lookup?apikey=***REMOVED***&term=/movie
addarr  | No error handlers are registered, logging exception.
addarr  | Traceback (most recent call last):
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/ext/_application.py", line 1234, in process_update
addarr  |     await coroutine
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/ext/_conversationhandler.py", line 857, in handle_update
addarr  |     new_state: object = await handler.handle_update(
addarr  |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/ext/_basehandler.py", line 157, in handle_update
addarr  |     return await self.callback(update, context)
addarr  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
addarr  |   File "/app/src/addarr.py", line 359, in choiceSerieMovie
addarr  |     return await searchSerieMovie(update, context)
addarr  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
addarr  |   File "/app/src/addarr.py", line 415, in searchSerieMovie
addarr  |     await context.bot.edit_message_text(
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/ext/_extbot.py", line 1473, in edit_message_text
addarr  |     return await super().edit_message_text(
addarr  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/_bot.py", line 525, in decorator
addarr  |     result = await func(self, *args, **kwargs)  # skipcq: PYL-E1102
addarr  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/_bot.py", line 3288, in edit_message_text
addarr  |     return await self._send_message(
addarr  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/ext/_extbot.py", line 522, in _send_message
addarr  |     result = await super()._send_message(
addarr  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/_bot.py", line 703, in _send_message
addarr  |     result = await self._post(
addarr  |              ^^^^^^^^^^^^^^^^^
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/_bot.py", line 613, in _post
addarr  |     return await self._do_post(
addarr  |            ^^^^^^^^^^^^^^^^^^^^
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/ext/_extbot.py", line 340, in _do_post
addarr  |     return await super()._do_post(
addarr  |            ^^^^^^^^^^^^^^^^^^^^^^^
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/_bot.py", line 641, in _do_post
addarr  |     return await request.post(
addarr  |            ^^^^^^^^^^^^^^^^^^^
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/request/_baserequest.py", line 200, in post
addarr  |     result = await self._request_wrapper(
addarr  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
addarr  |   File "/usr/local/lib/python3.11/site-packages/telegram/request/_baserequest.py", line 379, in _request_wrapper
addarr  |     raise BadRequest(message)
addarr  | telegram.error.BadRequest: Message to edit not found
Waterboy1602 commented 6 months ago

I can't replicate this issue. Could you give me some more information about what you're exactly doing when this crash happens?

heisenberg2980 commented 6 months ago

I am just following the normal process to search and download, which was working fine some time back. I am not sure when it started failing, but I know it was working in January 28th and I made some changes in the config file that I mentioned in the issue https://github.com/Waterboy1602/Addarr/issues/152 (according to the timing it could be related)

These are the steps I am following:

Then the error happens.

This is the radarr part of my config.yaml, just in case it helps:

radarr:
  server:
    addr: 192.168.0.208
    port : 7878 # Default is 7878
    path: / # Default is / . If set, it must start and finish with / . Eg: /radarr/
    ssl: false #default false
  auth:
    apikey: ***REMOVED***
    username: ***REMOVED***
    password: ***REMOVED***
  search: true
  minimumAvailability: announced
  excludedRootFolders: # If set must not have a trailing slash Eg: /mnt/Media
    - # First excluded folder, add others with a "-" on a new line (same indentation)
  excludedQualityProfiles:
    - Any
    - HD - 720p/1080p
    - HD-1080p
    - HD-720p
    - Minimum 720p - English
    - Minimum 1080p - Spanish
    - Minimum 720p - Spanish
    - SD
    - Ultra-HD 
  defaultTags: # If set must be existing tags
    - telegram
  adminRestrictions: false
  narrowRootFolderNames: true # If true, only the last folder name will be shown instead of full path
  addRequesterIdTag: true # Add telegram user id as tag on series

And this is ther addarr part of the docker-compose.yaml:

  addarr:
    container_name: addarr
    image: waterboy1602/addarr
    restart: unless-stopped
    network_mode: host
    volumes:
    - ./config/addarr/config.yaml:/app/config.yaml:ro
    - ./config/addarr/chatid.txt:/app/chatid.txt:rw
    - ./config/addarr/admin.txt:/app/admin.txt:ro
    - ./config/addarr/allowlist.txt:/app/allowlist.txt:ro
Waterboy1602 commented 6 months ago
addarr  | 2024-03-06 11:04:16,768 - addarr.radarr - INFO - http://192.168.0.208:7878/api/v3/movie/lookup?apikey=***REMOVED***&term=/movie

I was looking at your logs and noticed that you're requesting a movie with the title /movie. So I guess this has something to do with a bug in the flow of searching a movie.

Could you tell me the exact order of the messages that you're sending in Addarr?

heisenberg2980 commented 6 months ago

Ah sorry, that was just one of the test when I might have typed /movie twice (/movie is what I send to start the search) but the error happens with every movie.

This is the sequence of messages:

image

And the error happens when I click "Yes, add this"

08/03/2024
10:59:18
2024-03-08 10:59:18,065 - addarr.radarr - INFO - http://192.168.0.208:7878/api/v3/movie/lookup?apikey=***REMOVED***&term=the%20equalizer
08/03/2024
10:59:20
No error handlers are registered, logging exception.
08/03/2024
10:59:20
Traceback (most recent call last):
08/03/2024
10:59:20
  File "/usr/local/lib/python3.11/site-packages/telegram/ext/_application.py", line 1234, in process_update
08/03/2024
10:59:20
    await coroutine
08/03/2024
10:59:20
  File "/usr/local/lib/python3.11/site-packages/telegram/ext/_conversationhandler.py", line 857, in handle_update
08/03/2024
10:59:20
    new_state: object = await handler.handle_update(
08/03/2024
10:59:20
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
08/03/2024
10:59:20
  File "/usr/local/lib/python3.11/site-packages/telegram/ext/_basehandler.py", line 157, in handle_update
08/03/2024
10:59:20
    return await self.callback(update, context)
08/03/2024
10:59:20
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
08/03/2024
10:59:20
  File "/app/src/addarr.py", line 594, in pathSerieMovie
08/03/2024
10:59:20
    return await qualityProfileSerieMovie(update, context)
08/03/2024
10:59:20
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
08/03/2024
10:59:20
  File "/app/src/addarr.py", line 646, in qualityProfileSerieMovie
08/03/2024
10:59:20
    return await selectSeasons(update, context)
08/03/2024
10:59:20
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
08/03/2024
10:59:20
  File "/app/src/addarr.py", line 684, in selectSeasons
08/03/2024
10:59:20
    return await addSerieMovie(update, context)
08/03/2024
10:59:20
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
08/03/2024
10:59:20
  File "/app/src/addarr.py", line 817, in addSerieMovie
08/03/2024
10:59:20
    service.createTag(str(update.effective_message.chat.id))
08/03/2024
10:59:20
  File "/app/src/radarr.py", line 147, in createTag
08/03/2024
10:59:20
    "id": max([t["id"] for t in getTags()])+1,
08/03/2024
10:59:20
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
08/03/2024
10:59:20
ValueError: max() arg is an empty sequence
Waterboy1602 commented 6 months ago

I think I've solved this issue with my latest commit. The new docker image should compile in some time. Could you check if it works?

It had to do with an empty list of tags returned by Radarr. I see you've added the tag "telegram" in your config, but you've probably not created this tag in Radarr itself. Addarr at the moment doesn't create a tag if it doesn't exist yet. So it's looking for the tag, but doesn't get one returned and it crashes.

I had already fixed this for Sonarr, but forgot for Radarr. Now it should be alright.

heisenberg2980 commented 6 months ago

Thank you very much @Waterboy1602, after updating the container the issue is gone