dummylabs / thewatchman

Home Assistant custom integration to keep track of missing entities and actions in your config files
MIT License
475 stars 20 forks source link

The Watchmen fail to install with "Config flow could not be loaded: {"message":"Invalid handler specified"}" #72

Closed WillemGoosen closed 1 year ago

WillemGoosen commented 1 year ago

Hi All Please help!!!

I just must have “The Watchman” installed on Home Assistant but after the latest update v0.6.0 it is not working anymore and in trying to remove and re-install I now get the following errors. Even trying to re-install an older version I still have problems.

Config flow could not be loaded: {"message":"Invalid handler specified"}

This error originated from a custom integration.

Logger: homeassistant.loader Source: custom_components/watchman/utils.py:12 Integration: Watchman (documentation, issues) First occurred: 8:21:33 PM (1 occurrences) Last logged: 8:21:33 PM

Unexpected exception importing platform custom_components.watchman.config_flow

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 728, in get_platform cache[full_name] = self._import_platform(platform_name) File "/usr/src/homeassistant/homeassistant/loader.py", line 745, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 992, in _find_and_load_unlocked File "", line 241, in _call_with_frames_removed File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/config/custom_components/watchman/init.py", line 27, in from .coordinator import WatchmanCoordinator File "/config/custom_components/watchman/coordinator.py", line 8, in from .utils import check_entitites, check_services, get_entity_state, fill File "/config/custom_components/watchman/utils.py", line 12, in from prettytable import PrettyTable File "/usr/local/lib/python3.10/site-packages/prettytable/init.py", line 1, in from .prettytable import ( File "/usr/local/lib/python3.10/site-packages/prettytable/prettytable.py", line 45, in import wcwidth File "/usr/local/lib/python3.10/site-packages/wcwidth/init.py", line 12, in from .wcwidth import ZERO_WIDTH # noqa File "/usr/local/lib/python3.10/site-packages/wcwidth/wcwidth.py", line 72, in from .table_zero import ZERO_WIDTH File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 879, in exec_module File "", line 1012, in get_code File "", line 672, in _compile_bytecode ValueError: bad marshal data (invalid reference) Log Details (ERROR) Logger: homeassistant.config_entries Source: config_entries.py:834 First occurred: 8:21:33 PM (1 occurrences) Last logged: 8:21:33 PM Error occurred loading configuration flow for integration watchman: Exception importing custom_components.watchman.config_flow Thanks Much Appreciated.

dummylabs commented 1 year ago

Hi, it seems like an issue with your setup. There were no updates to Watchman since June 2022 (my bad, hope to deliver new features soon), however it should work fine with the recent version of HA. I've just checked that by removing Watchman from HACS and then installed it again without any problems on 2022.12.8.

Could you please do the following:

  1. Uninstall Watchman from Settings->Devices and Services
  2. Open HACS and remove Watchman integration (three dots menu in the top right corner)
  3. Make sure there is no watchman folder left in /config/custom_components
  4. You may want to restart HA at this moment just to be on the safe side, though it is not required
  5. Install Watchman integration via HACS (version 0.6.0) and restart Home Assistant
  6. Install Watchman from Settings->Devices and Services
WillemGoosen commented 1 year ago

Hi I have tried steps 1 to 6 in uninstalling "The Watchman" even did it again before replying here. In step 3, I had the custom_components folder open and watched as the watchman folder disappeared when uninstalling. To be sure I did do a HA & VM restart at this point. But still the same error.

WillemGoosen commented 1 year ago

At the bottom of the large error log the following is displayed: ValueError: bad marshal data (invalid reference)

After the failed install a new folder is created within watchman: pycache

This folder then has the following files: init.cpython-310.pyc const.cpython-310.pyc coordinator.cpython-310.pyc utils.cpython-310.pyc

My HA version: Home Assistant 2022.12.8 Supervisor 2022.12.1 Operating System 9.4 Frontend 20221213.1 - latest

WillemGoosen commented 1 year ago

The folder is pycache Two underscores before and after.

dummylabs commented 1 year ago

__pycache__ is a service folder where Python keeps pre-compiled modules to reduce the launch time. Google says that a reason for "bad marshal data" error can be corrupted .pyc files (which actually are pre-compiled modules stored in__pycache__ folder). This is strange because you've already removed the whole Watchman component and installed it from scratch. Anyway, you can safely delete __pycache__ folder at any time, the Python interpreter will re-create it after HA restart.

So far no ideas left. Since you have a hypervisor, may be a good idea to create another temporary VM with fresh Home Assistant install and HACS to check if Watchman works there. My guess is that something is wrong with the Python environment within the HA Operating System.

Edit: another (less time-consuming) idea is to install any other integration from HACS and check if the same error occurs. If this is an environment problem, it should happen to any other integration.

WillemGoosen commented 1 year ago

Hi Thanks for the feedback. I am restoring an old vm backup and will test from there.

Again, thanks for the feedback.

Much appreciated.

Will let you know what worked.

Happy new year.

Willem HJ Goosen 078 423 4192 Mobile Sent from my LG Mobile


From: dummylabs @.> Sent: Friday, December 30, 2022 11:42:34 PM To: dummylabs/thewatchman @.> Cc: WillemGoosen @.>; Author @.> Subject: Re: [dummylabs/thewatchman] The Watchmen fail to install with "Config flow could not be loaded: {"message":"Invalid handler specified"}" (Issue #72)

pycache is a service folder where Python keeps pre-compiled modules to reduce the launch time. Google says that a reason for "bad marshal data" error can be corrupted .pyc files (which actually are pre-compiled modules stored in pycache folder). This is strange since you've already removed the whole Watchyman component and installed it from scratch. Anyway, you can safely delete pycache folder at any time, the Python interpreter will re-create it after HA restart.

So far no ideas left. Since you have a hypervisor, may be a good idea to create another temporary VM with fresh Home Assistant install and HACS to check if Watchman works there. My guess is that something is wrong with the Python environment within the HA Operating System.

— Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdummylabs%2Fthewatchman%2Fissues%2F72%23issuecomment-1368099025&data=05%7C01%7C%7Cee74abc6bfc240d6dd4c08daeaaec357%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638080333560270599%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Uqmqi%2B1%2BI9mgY56Skek2C7CN0HMdUmJVMmYRLr7pYo8%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPSRFBKJUJKWHREQZHU3ZLTWP5JMVANCNFSM6AAAAAATM3GLBA&data=05%7C01%7C%7Cee74abc6bfc240d6dd4c08daeaaec357%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638080333560270599%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=QE9RhyHi65sTuF3REvl338u696yENxauBkRanmjZZNk%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

WillemGoosen commented 1 year ago

Hi all Fortunately, I export my VirtualBox VM each month before commencing with updates. So, I restored and re-updated with all working as they should including “The Watchmen” Thanks for all your help much appreciated.