mopidy-tidal icon indicating copy to clipboard operation
mopidy-tidal copied to clipboard

Errors in log

Open fmarzocca opened this issue 1 year ago • 9 comments

Recently, I am experiencing a lot of errors in the log, like this one:

2024-01-26 04:41:53,633 INFO [625:TidalBackend-3 (_actor_loop)] pykka: Exception returned from TidalBackend (urn:uuid:c12e6639-b865-4eb5-84d0-0aee7dc6d629) to caller:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 186, in _actor_loop
    response = self._handle_receive(envelope.message)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 286, in _handle_receive
    return callee(*message.args, **message.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mopidy/backend.py", line 331, in change_track
    uri = self.translate_uri(track.uri)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mopidy_tidal/login_hack.py", line 306, in wrapper
    return fn(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mopidy_tidal/playback.py", line 36, in translate_uri
    newurl = session.track(track_id).get_url()
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/tidalapi/session.py", line 571, in track
    item = media.Track(session=self, media_id=track_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/tidalapi/media.py", line 86, in __init__
    self._get(self.id)
  File "/usr/local/lib/python3.11/dist-packages/tidalapi/media.py", line 192, in _get
    track = self.requests.map_request("tracks/%s" % media_id, parse=parse)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/tidalapi/request.py", line 129, in map_request
    json_obj = self.request("GET", url, params).json()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/tidalapi/request.py", line 107, in request
    request.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 1021, in raise_for_status
      raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.tidal.com/v1/tracks/229782957?sessionId=xx&countryCode=IT&limit=1000```

Versions mopidy-tidal==0.3.4 tidalapi==0.7.3

fmarzocca avatar Jan 26 '24 10:01 fmarzocca

I had a similar problem this morning but maybe unrelated to the issue you are having. Have you tried logging in again/re-auth (i.e. deleting the file /var/lib/mopidy/tidal/tidal-oauth.json) ?

What quality setting are you using?

tehkillerbee avatar Jan 26 '24 13:01 tehkillerbee

I didn't delete the oath.json, will try. quality = LOSSLESS

Could the issue be related to python3.11?

fmarzocca avatar Jan 26 '24 13:01 fmarzocca

Could the issue be related to python3.11?

I don't think so, I think the existing tests include python 3.11. I currently use python3.9 and python 3.10.

Does this issue occur with any album? Can you share a link to the album? Maybe playback has been disabled by Tidal.

tehkillerbee avatar Jan 26 '24 13:01 tehkillerbee

examples of failing addresses:

url: https://api.tidal.com/v1/tracks/224308115? sessionId=xx&countryCode=IT&limit=1000

TIDAL uri: tidal:track:3684905:224308107:224308115

url: https://api.tidal.com/v1/tracks/114678110? sessionId=xx&countryCode=IT&limit=1000

uri: tidal:track:6454895:114678109:114678110

Edit: removed sessionId

fmarzocca avatar Jan 26 '24 13:01 fmarzocca

Can you provide links to these tracks/albums on the tidal web player? I do not seem to be able to access them (album 224308107 and album 114678109) so perhaps they have been removed.

Does playback work with other albums, tracks?

tehkillerbee avatar Jan 26 '24 13:01 tehkillerbee

I will try, but maybe they have been removed.

fmarzocca avatar Jan 26 '24 14:01 fmarzocca

In https://github.com/tamland/python-tidal/pull/224 I have added some additional log info so that should clarify what causes this issue in the future.

tehkillerbee avatar Jan 26 '24 17:01 tehkillerbee

Are you going to release?

fmarzocca avatar Jan 26 '24 19:01 fmarzocca

Yes, next release of tidalapi should be released soon. But you can also update from latest master

tehkillerbee avatar Jan 26 '24 20:01 tehkillerbee

I have had similar issues: at a guess they might be stale cache data? I've noticed btw that the file cache never evicts. Tidal might just have changed the ids for some things.

2e0byo avatar Feb 03 '24 18:02 2e0byo

This morning I had a new one:

2024-02-15 08:30:09,223 ERROR [664:Core-13 (_actor_loop)] mopidy.core.library: TidalBackend backend caused an 
exception.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mopidy/core/library.py", line 17, in _backend_error_handling
    yield
  File "/usr/lib/python3/dist-packages/mopidy/core/library.py", line 230, in lookup
    result = future.get()
             ^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pykka/_threading.py", line 55, in get
    raise exc_value
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 186, in _actor_loop
    response = self._handle_receive(envelope.message)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 286, in _handle_receive
    return callee(*message.args, **message.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mopidy_tidal/login_hack.py", line 237, in wrapper
    return fn(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mopidy_tidal/library.py", line 325, in lookup
    data = cache_data = lookup(self._session, parts)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mopidy_tidal/library.py", line 420, in _lookup_track
    track = next(t for t in tracks if t.id == int(track_id))  # pragma: no cover
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

fmarzocca avatar Feb 15 '24 08:02 fmarzocca

This morning I had a new one:

2024-02-15 08:30:09,223 ERROR [664:Core-13 (_actor_loop)] mopidy.core.library: TidalBackend backend caused an 
exception.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mopidy/core/library.py", line 17, in _backend_error_handling
    yield
  File "/usr/lib/python3/dist-packages/mopidy/core/library.py", line 230, in lookup
    result = future.get()
             ^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pykka/_threading.py", line 55, in get
    raise exc_value
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 186, in _actor_loop
    response = self._handle_receive(envelope.message)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pykka/_actor.py", line 286, in _handle_receive
    return callee(*message.args, **message.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mopidy_tidal/login_hack.py", line 237, in wrapper
    return fn(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mopidy_tidal/library.py", line 325, in lookup
    data = cache_data = lookup(self._session, parts)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/mopidy_tidal/library.py", line 420, in _lookup_track
    track = next(t for t in tracks if t.id == int(track_id))  # pragma: no cover
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

Yep, I got exactly the same one when testing yesterday. It occurs when trying to iterate over tracks in an album that is not available anymore. I have added some extra error handling to avoid that issue in the future and this will be part of the next release of mopidy-tidal.

Most of these confusing errors have been fixed in the next release of mopidy, simply by improving the error handling of both mopidy-tidal and tidalapi.

tehkillerbee avatar Feb 15 '24 08:02 tehkillerbee

All these issues are resolved in #153 #151

tehkillerbee avatar Feb 29 '24 23:02 tehkillerbee