Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: 'SonarrQueueDetail' object has no attribute 'timeleft' #81508

Closed
tankdeer opened this issue Nov 3, 2022 · 13 comments
Closed

Exception: 'SonarrQueueDetail' object has no attribute 'timeleft' #81508

tankdeer opened this issue Nov 3, 2022 · 13 comments

Comments

@tankdeer
Copy link

tankdeer commented Nov 3, 2022

The problem

After upgrading core, the Sonarr integration has started throwing the following exception.

What version of Home Assistant Core has the issue?

2022.11.0

What was the last working version of Home Assistant Core?

2022.10.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Sonarr

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sonarr

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-11-03 11:54:59.789 ERROR (MainThread) [homeassistant.components.sonarr] Unexpected error fetching sonarr data: 'SonarrQueueDetail' object has no attribute 'timeleft'
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/request_client.py", line 183, in _async_request
    response = BaseModel(
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 95, in __init__
    value = generate_data(value, datatype)
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 78, in generate_data
    return datatype(data)
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 116, in __init__
    self.__post_init__()
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/sonarr.py", line 193, in __post_init__
    self.records = [SonarrQueueDetail(record) for record in self.records]
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/sonarr.py", line 193, in <listcomp>
    self.records = [SonarrQueueDetail(record) for record in self.records]
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 116, in __init__
    self.__post_init__()
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/sonarr.py", line 176, in __post_init__
    super().__post_init__()
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/request_common.py", line 165, in __post_init__
    and self.timeleft == "00:00:00"
AttributeError: 'SonarrQueueDetail' object has no attribute 'timeleft'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/components/sonarr/coordinator.py", line 67, in _async_update_data
    return await self._fetch_data()
  File "/usr/src/homeassistant/homeassistant/components/sonarr/coordinator.py", line 118, in _fetch_data
    return await self.api_client.async_get_queue(
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/sonarr_client.py", line 137, in async_get_queue
    return await self._async_request("queue", params=params, datatype=SonarrQueue)
  File "/usr/local/lib/python3.10/site-packages/aiopyarr/request_client.py", line 207, in _async_request
    raise ArrException(self, ex) from ex
aiopyarr.exceptions.ArrException: 'SonarrQueueDetail' object has no attribute 'timeleft'

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Nov 3, 2022

Hey there @ctalkington, mind taking a look at this issue as it has been labeled with an integration (sonarr) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of sonarr can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign sonarr Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


sonarr documentation
sonarr source
(message by IssueLinks)

@NanoSector
Copy link

This seems to stem from this PR merged in aiopyarr: tkdrob/aiopyarr#56

Looking at the python code, not every model class seems to implement timeleft so this PR made a wrong assumption. I'll open a ticket with the upstream repository.

@NanoSector
Copy link

I've narrowed this down to having stalled qBittorrent downloads in your queue as you can see in the issue linked in aiopyarr above. You can either remove your stalled downloads, or move them out of the Sonarr download category if you have that set; that fixes the error for me.

@tankdeer
Copy link
Author

tankdeer commented Nov 6, 2022

Thanks. Seems like a good workaround until a fix is merged. I see you submitted a PR, so hopefully that resolves it

@tkdrob
Copy link
Contributor

tkdrob commented Nov 6, 2022

More on what @NanoSector was saying, this appears to differ between download clients. I don't use qBittorrent and am not having this issue.

@tankdeer
Copy link
Author

tankdeer commented Nov 6, 2022

Nor do I - I am using transmission

@tkdrob tkdrob mentioned this issue Nov 6, 2022
19 tasks
@NanoSector
Copy link

I see it's been added to the 2022.11.2 milestone - thanks @tkdrob !

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@rpatterson
Copy link

I was seeing this regularly before, and I haven't seen this in some time, so I suspect it's been resolved by the above releases, though I don't have any technical insight to back that up.

@github-actions github-actions bot removed the stale label Feb 7, 2023
@taw123
Copy link

taw123 commented Mar 28, 2023

Issues is also present in Lidarr (built on same common code). Will attempt to move stalled qBit torrents to another catagory to test but both can confirm issue is still preset….. I’ll post follow up after testing the relocation of torrents and can provide logs if desired but it seems the problem was well understood just yet to see fix pushed for this. Thanks !

@tkdrob
Copy link
Contributor

tkdrob commented Mar 29, 2023

Issues is also present in Lidarr (built on same common code). Will attempt to move stalled qBit torrents to another catagory to test but both can confirm issue is still preset….. I’ll post follow up after testing the relocation of torrents and can provide logs if desired but it seems the problem was well understood just yet to see fix pushed for this. Thanks !

Have you updated to the latest Home Assistant?

@taw123
Copy link

taw123 commented Mar 29, 2023

Issues is also present in Lidarr (built on same common code). Will attempt to move stalled qBit torrents to another catagory to test but both can confirm issue is still preset….. I’ll post follow up after testing the relocation of torrents and can provide logs if desired but it seems the problem was well understood just yet to see fix pushed for this. Thanks !

Have you updated to the latest Home Assistant?

Apologies for the brevity in my earlier post. I opened an issue directly under Lidarr (referenced above). With further details and referring back here for potential context.

To answer your question, yes I am on HA:latest, and Lidarr:latest, pulled earlier this morning before regression testing above. Specifically Lidarr Version: 1.0.2.2592, HA docker: 2023.3.6
Frontend 20230309.1

@tkdrob tkdrob mentioned this issue Apr 9, 2023
20 tasks
@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants