home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.78k stars 30.04k forks source link

Media_Source throws error for item in Local Media folder #72845

Closed RogerSelwyn closed 8 months ago

RogerSelwyn commented 2 years ago

The problem

I am getting an error shown when I click on an image in my media folder surfaced as Local Media in the Media panel, I would expect there to be npc error shown

What version of Home Assistant Core has the issue?

core-2022.6.0

What was the last working version of Home Assistant Core?

core-2022.5.x

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

media_source

Link to integration documentation on our website

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

Diagnostics information

System Health

version core-2022.6.0
installation_type Home Assistant Supervised
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.12
os_name Linux
os_version 5.10.0-14-arm64
arch aarch64
timezone Europe/London
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4516 Installed Version | 1.25.5 Stage | running Available Repositories | 1043 Downloaded Repositories | 12
Home Assistant Supervisor host_os | Debian GNU/Linux 11 (bullseye) -- | -- update_channel | stable supervisor_version | supervisor-2022.05.3 agent_version | 1.2.2 docker_version | 20.10.16 disk_total | 61.3 GB disk_used | 21.4 GB healthy | true supported | true supervisor_api | ok version_api | ok installed_addons | File editor (5.3.3), SSH & Web Terminal (10.1.3), AdGuard Home (4.5.1), Grafana (7.5.2), MariaDB (2.4.0), Mosquitto broker (6.1.2), Nginx Proxy Manager (0.11.0), Node-RED (11.1.2), Ring-MQTT with Video Streaming (5.0.1), texecom2mqtt (1.2.3), Samba share (9.6.1), Z-Wave JS to MQTT (0.42.0), Apache2 (2.2.2), FTP (4.5.0), phpMyAdmin (0.7.1)
Dashboards dashboards | 3 -- | -- resources | 6 views | 11 mode | storage
Recorder oldest_recorder_run | 22 May 2022, 11:38 -- | -- current_recorder_run | 1 June 2022, 18:11 estimated_db_size | 444.80 MiB database_engine | mysql database_version | 10.4.19

Example YAML snippet

No response

Anything in the logs that might be useful for us?

The error shown below is a filename because I made a temporary modification to identify what was triggering the error.

2022-06-01 18:12:10 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that calls media_source.async_resolve_media without passing an entity_idmedia-source://media_source/local/day/2022-05-30 10.17.35.jpg. Please report issue to the custom component author for media_source using this method at custom_components/media_source/__init__.py, line 138: report(

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

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


media_source documentation media_source source (message by IssueLinks)

jgverweij commented 2 years ago

Same error when deleting file in Local media folder using the local media management. (I don't use a custom component.)

I am on version 2022.6.0

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:103
First occurred: 16:57:17 (1 occurrences)
Last logged: 16:57:17

Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/__init__.py, line 138: report("calls media_source.async_resolve_media without passing an entity_id")
andriej commented 2 years ago

Same error on 2022.6.6

mattpurnell commented 2 years ago

I also get this error when the 'gallery-card' tries to refresh image/video content via a media_source. It suceeds, but not before it throws exceptions.

Home Assistant 2022.8.7 Frontend 20220802.0 - latest

2022-09-04 22:24:26.359 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that calls media_source.async_resolve_media without passing an entity_id. **Please report issue for media_source using this method at homeassistant/components/media_source/__init__.py, line 138: report("calls media_source.async_resolve_media without passing an entity_id")**
2022-09-04 22:24:26.981 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1191, in _sendfile_fallback
    read = await self.run_in_executor(None, file.readinto, view)
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 514, in start
    resp, reset = await task
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 460, in _handle_request
    reset = await self.finish_response(request, resp, start_time)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 613, in finish_response
    await prepare_meth(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_fileresponse.py", line 286, in prepare
    return await self._sendfile(request, fobj, offset, count)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_fileresponse.py", line 99, in _sendfile
    await loop.sendfile(transport, fobj, offset, count)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1170, in sendfile
    return await self._sendfile_fallback(transport, file,
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1200, in _sendfile_fallback
    await proto.restore()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 268, in restore
    self._transport.resume_reading()
  File "/usr/local/lib/python3.10/asyncio/sslproto.py", line 343, in resume_reading
    self._ssl_protocol._transport.resume_reading()
AttributeError: 'NoneType' object has no attribute 'resume_reading'
2022-09-04 22:24:27.136 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1191, in _sendfile_fallback
    read = await self.run_in_executor(None, file.readinto, view)
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 514, in start
    resp, reset = await task
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 460, in _handle_request
    reset = await self.finish_response(request, resp, start_time)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 613, in finish_response
    await prepare_meth(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_fileresponse.py", line 286, in prepare
    return await self._sendfile(request, fobj, offset, count)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_fileresponse.py", line 99, in _sendfile
    await loop.sendfile(transport, fobj, offset, count)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1170, in sendfile
    return await self._sendfile_fallback(transport, file,
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1200, in _sendfile_fallback
    await proto.restore()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 268, in restore
    self._transport.resume_reading()
  File "/usr/local/lib/python3.10/asyncio/sslproto.py", line 343, in resume_reading
    self._ssl_protocol._transport.resume_reading()
AttributeError: 'NoneType' object has no attribute 'resume_reading'
misaligar commented 2 years ago

Also having this issue on 2022.9.2 when playing music on Apple HomePad Mini.

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 10:37:30 AM (1 occurrences)
Last logged: 10:37:30 AM
Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/__init__.py, line 138: report("calls media_source.async_resolve_media without passing an entity_id")
tonizombie commented 2 years ago

Same issue on core-2022.7.7, while using the android app, windows 10 chrome and firefox

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:103
First occurred: 19:41:27 (1 occurrences)
Last logged: 19:41:27

Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/__init__.py, line 138: report("calls media_source.async_resolve_media without passing an entity_id")
AJStubbsy commented 1 year ago

Comment to keep the issue alive. Same for me: -

Home Assistant 2022.10.1 Supervisor 2022.10.0 Operating System 9.2 Frontend 20221006.0 - latest

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 8 October 2022 at 11:58:39 (1 occurrences)
Last logged: 8 October 2022 at 11:58:39

Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/__init__.py, line 147: report("calls media_source.async_resolve_media without passing an entity_id")
JimGermany commented 1 year ago

Home Assistant 2022.10.4 Supervisor 2022.10.0 Operating System 9.2 Frontend 20221010.0 - latest

Play Media --> DLNA Servers (OpenMediaVault) --> Music- or Video-File --> Browser Only sometimes (I can't see any connection)

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 13:03:37 (1 occurrences)
Last logged: 13:03:37

Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/__init__.py, line 147: report("calls media_source.async_resolve_media without passing an entity_id")
Joo01 commented 1 year ago

Home Assistant 2022.12.8 Supervisor 2022.12.1 Operating System 9.4 Frontend 20221213.1 - latest

Same issue in 2022.12.8

2022-12-30 14:04:14.362 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/init.py, line 147: report("calls media_source.async_resolve_media without passing an entity_id")

woempiej commented 1 year ago

Home Assistant 2023.1.0 Supervisor 2022.12.1 Operating System 9.4 Frontend-versie: 20230104.0 - latest

Logger: homeassistant.helpers.frame Source: helpers/frame.py:77 First occurred: 15:34:43 (1 occurrences) Last logged: 15:34:43 Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/init.py, line 147: report("calls media_source.async_resolve_media without passing an entity_id")

jprasm commented 1 year ago

Logger: homeassistant.helpers.frame Source: helpers/frame.py:77 First occurred: 09:17:03 (1 occurrences) Last logged: 09:17:03

Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/init.py, line 147: report("calls media_source.async_resolve_media without passing an entity_id")

frank-dusign commented 1 year ago

HA 2023.02.00 Occures when playback a video on media section of HA. Takes about a minute before playback starts Logger: homeassistant.helpers.frame Source: helpers/frame.py:77 First occurred: 11:11:16 (1 occurrences) Last logged: 11:11:16

Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/init.py, line 147: report("calls media_source.async_resolve_media without passing an entity_id")

balrog-kun commented 1 year ago

Still broken in 2023.3.1.

It is related to commit f76afffd5ab12014d1e506ed1ab3c38f2ed3b8f1 and pull req #72593 but I'm not sure this is actually the culprit. That commit added a third argument to media_source.async_resolve_media() but some callers have not been updated, specifically in media_source.websocket_resolve_media() in the very same file. This is triggered when you try to play media in the browser using the browser as the media player, so there's logically no entity_id that can be passed. However playing in the browser still works because this is non-fatal. What is actually broken (for me) is playing on media_player.gstreamer and this commit doesn't seem related to that.

Also playing media in either the browser or media_player.gstreamer generates some javascript errors, which may be related to the issue.

In any case it's surprising that no developer has spotted this in over 6 months since that pull request or during the review.

JimGermany commented 1 year ago

Home Assistant 2023.2.5 Supervisor 2023.01.1 Operating System 9.5

@balrog-kun I don't currently have an error message for Media Source in the log, but the media playback has probably had one or the other problem for a while (months). For example: I have integrated 4 Onvif cameras into HA, which all work without any problems. Sometimes they show up on Media --> Media Source - Camera and other times they don't and only incompatible devices are displayed. That means sometimes they just disappear until Home Assistant is rebooted again. But if I create an automation or script for example, the cameras are always available there and can be selected.

I've given up trying to find the cause or how to fix the problem.

woempiej commented 1 year ago

The problem is still there.

Home Assistant 2023.3.5 Supervisor 2023.03.1 Operating System 9.5 Frontend-versie: 20230309.1

heyitsyang commented 1 year ago

I see it also

Home Assistant 2023.4.6 Supervisor 2023.04.1 Operating System 10.0 Frontend 20230411.1 - latest

My media players: Sonos speakers Samsung TV ESPHome i2s audio

nima-1102 commented 1 year ago

Same WARNING:

Home Assistant 2023.5.0 Supervisor 2023.04.1 Operating System 10.1 Frontend 20230503.1 - latest

tefracky commented 1 year ago

Logger: homeassistant.helpers.frame Source: helpers/frame.py:77 First occurred: 12:21:21 (1 occurrences) Last logged: 12:21:21

Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/init.py, line 151: report("calls media_source.async_resolve_media without passing an entity_id")

issue-triage-workflows[bot] commented 1 year ago

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.

tefracky commented 1 year ago

The problem still exist

nielsaust commented 11 months ago

I also have this issue still:

Logger: homeassistant.helpers.frame Source: helpers/frame.py:103 First occurred: 12:34:05 PM (1 occurrences) Last logged: 12:34:05 PM

Detected integration that calls media_source.async_resolve_media without passing an entity_id. Please report issue for media_source using this method at homeassistant/components/media_source/init.py, line 151: report("calls media_source.async_resolve_media without passing an entity_id")

issue-triage-workflows[bot] commented 8 months ago

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.