core: Media_Source throws error for item in Local Media folder

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 22 (1 by maintainers)

Most upvoted comments

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'