alexa_media_player: Can't add integration (Config flow could not be loaded: {"message":"Invalid handler specified"})
When trying to add the integration a popup shows with the following message:
Config flow could not be loaded: {“message”:“Invalid handler specified”}
It was working but it stopped working since upgrading HA to 2024.6.3 (I think because of #2288) and wasn’t able to reload (there was no reload option). I decided to remove the integration, remove the component from HACS and start fresh, but after adding the component with HACS and trying to add the integration I get the error.
- Go to ‘Settings > Devices & services’
- Click on ‘Add integration > Alexa Media Player’
- See error
System details
- Home-assistant (version): Core 2024.6.5, OS 12.4
- alexa_media (version from
const.pyor HA startup): 4.10.2 - alexapy (version from
pip show alexapyor HA startup): for some reason can’t figure out,pip show alexapyreturns Package(s) not found: alexapy - Amazon 2FA is enabled (y/n). : yes
Logs
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1249, in _load_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1281, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 131, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/config/custom_components/alexa_media/__init__.py", line 16, in <module>
from alexapy import (
File "/usr/local/lib/python3.12/site-packages/alexapy/__init__.py", line 41, in <module>
__maintainer__ = metadata["maintainer"]
~~~~~~~~^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in __getitem__
raise KeyError(item)
KeyError: 'maintainer'
2024-06-29 08:33:26.214 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to import_module inside the event loop by integration 'config' at homeassistant/components/config/config_entries.py, line 179: return await super()._post_impl(request, data) (offender: /usr/src/homeassistant/homeassistant/loader.py, line 1281: return importlib.import_module(f"{self.pkg_path}.{platform_name}")), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+config%22
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, in _run_once
handle._run()
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
return await func(self, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 70, in wrapper
return await method(view, request, data, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 172, in post
return await self._post_impl(request, data)
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 179, in _post_impl
return await super()._post_impl(request, data)
2024-06-29 08:33:26.216 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.alexa_media.config_flow
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1249, in _load_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1281, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 131, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/config/custom_components/alexa_media/__init__.py", line 16, in <module>
from alexapy import (
File "/usr/local/lib/python3.12/site-packages/alexapy/__init__.py", line 41, in <module>
__maintainer__ = metadata["maintainer"]
~~~~~~~~^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/importlib_metadata/_adapters.py", line 54, in __getitem__
raise KeyError(item)
KeyError: 'maintainer'
2024-06-29 08:33:26.217 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration alexa_media: Exception importing custom_components.alexa_media.config_flow
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 93
I’m seeing that issue as well and I’m currently trying to figure out what I’ve done wrong…
And just remember that I am just an average user like yourself but with a 35+ professional background in programming and IT support and only 4 years using Home Assistant and 2 years doing my best to give back to the community. Also just remember that your issue stems from the fact that your cloudflare appears to not be configured properly to pass auth callbacks and any integration you install that uses auth callback for cloud authentication will also fail. This is not Alexa Media Player’s fault and it reared its ugly head with suspected HA internal structure & processing changes from 2024.6.2 to 2024.6.3. If you still feel the same as you did 8 hours ago then I’m sorry I wasted so much of my valuable time on this issue.
Once my config enhancement PR is finalized, i can issue a new PR to incorporate the new manifest.json…
Yes, it does indeed! Thank you! 🙏
@alandtse Please close this. Thanks.
At that time, deleting the file alexa media.pickle helped me
This is now very weird! @st3v3nFr is fine now. @edudele, can you try this. It’s a stab in the dark and a bit lengthy but…
/config/.storage/alexa_media.<your_email>.pickleLike I said, a lot of steps but just trying to be thorough…
Hi Daniel and thank you for your help 😃 Please be aware that adding a ‘importlib-metadata==6.8.0’ is temporary fix, and may either not work later or cause issues, depends on what other lin HA will be using in a further update !
Resolved, you were right, reinstalled, and it works now. Thanks a lot
@nstyqz : Thank you! That error is the subject of this issue. I’ve published v4.10.3.1 with the modified manifest.json. Give that a whirl and see what happens!
I’ve alerted Alan to this issue but he has no idea where the problem is coming from. I am running 4.3.10.1 (even though I did not need it) with no ill effects that I can see…
I’ve published v4.10.3.1 with the
"importlib-metadata==6.8.0"requirement.I have to re-add custom repository to see it…
The only integration I see in my HACS store is alantse’s…
and after deleting my custom repository…
I started with it completely removed and just did this:
Okay, I’ve managed to figure out my mistakes and have successfully added & configured Alexa Media Player from danielbrunt57/alexa_media_player
Correct, I’m trying to sort through my mistakes. Forgive me, but this is my first attempt with AMP. I’ve forked and modified a couple other repositories to temporarily fix an issue with them that was then fixed by the dev thus permitting me to remove my fork but I never ran issues like this one…
Yeyeah man, that’s the mistake
@nstyqz Is this the unknown error you saw?
Thanks, I will look into it tonight
To try it, proceed as follows: HA Integrations > Alexa Media Player > Delete your entry HACS > Alexa Media Player > Remove HACS > add custom repository > https://github.com/danielbrunt57/alexa_media_player HACS > Download and Install my version of Alexa Media Player Restart HA (installs the HACS custom component plus adds the alexapy module to HA itself) Restart HA (initializes HA with the new alexapy module now running) HA > Integrations > Add Alexa Media Player, configure it and see if it initializes. Restart HA and see if it is still okay.
FWIW, I’m running Home Assistant Operating System on the HA “Blue” ODROID N2+ platform. I’m kinda wondering if there’s not something more majorly out of whack amongst the different platforms that HA can run in. But more likely, it could be something simpler like things you have added that I have not that somehow are affecting HA & or alexapy. Just my educated “what if?..” thinking out loud…
My config has those exact same lines…
I’m still using the python 3.13beta3 cookies.py file from PR gh-112713 though but that should be irrelevant to this issue…