Appdaemon Warning: TypeError: argument of type 'NoneType' is not iterable

Any idea why this (see below) has been showing up a lot in my logs?

If I understand this correctly, it’s saying that config is None? In which case, would AppDAemon even work? (All my apps work as expected).

Warning that keeps popping up:

2023-12-22 23:25:15.933174 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 578, in read_config_file
    return utils.read_config_file(file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 586, in read_config_file
    return read_yaml_config(path)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 724, in read_yaml_config
    if "secrets" in config:
       ^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Take out sensitive parts of your config file and share it. Seems like it might have something to do with using the “secrets” keyword.

You mean just the appdaemon.yaml? It’s pretty minimal:

---
secrets: /homeassistant/secrets.yaml
appdaemon:
  latitude: REDACTED
  longitude: REDACTED
  elevation: REDACTED
  time_zone: REDACTED
  plugins:
    HASS:
      type: hass
http:
  url: http://127.0.0.1:5050
admin:
api:
hadashboard:

Changed /config/secrets.yaml to /homeassistant/secrets.yaml when addon configs moved to the addon_configs mount.

I’m not really sure which app this is coming from, I have a bunch of app config files split between “types” of things. But I just made a test:

test:
    module: test
    class: Test
    grocy_api_key: !secret grocy_api_key

and if I try logging self.args['grocy_api_key'] from test.py, I get the correct value from my secrets.yaml file.

EDIT: I noticed that when I added the test app, it looked fine. When I commented the config for the app in test.yaml, this appeared in the logs:

everything logged at that second below
2023-12-28 17:08:26.552702 INFO AppDaemon: Reading config
2023-12-28 17:08:26.612097 WARNING AppDaemon: ------------------------------------------------------------
2023-12-28 17:08:26.612482 WARNING AppDaemon: Unexpected error loading config file: /config/apps/globals/globals.yaml
2023-12-28 17:08:26.612682 WARNING AppDaemon: ------------------------------------------------------------
2023-12-28 17:08:26.613539 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 578, in read_config_file
    return utils.read_config_file(file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 586, in read_config_file
    return read_yaml_config(path)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 724, in read_yaml_config
    if "secrets" in config:
       ^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

2023-12-28 17:08:26.613787 WARNING AppDaemon: ------------------------------------------------------------
2023-12-28 17:08:26.617029 WARNING AppDaemon: File '/config/apps/globals/globals.yaml' invalid structure - ignoring
2023-12-28 17:08:26.744541 WARNING AppDaemon: global_modules directive has been deprecated and will be removed in a future release
2023-12-28 17:08:26.749099 WARNING AppDaemon: ------------------------------------------------------------
2023-12-28 17:08:26.749759 WARNING AppDaemon: Unexpected error loading config file: /config/apps/test/test.yaml
2023-12-28 17:08:26.751034 WARNING AppDaemon: ------------------------------------------------------------
2023-12-28 17:08:26.752187 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 578, in read_config_file
    return utils.read_config_file(file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 586, in read_config_file
    return read_yaml_config(path)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 724, in read_yaml_config
    if "secrets" in config:
       ^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

2023-12-28 17:08:26.752438 WARNING AppDaemon: ------------------------------------------------------------
2023-12-28 17:08:26.757032 WARNING AppDaemon: File '/config/apps/test/test.yaml' invalid structure - ignoring
2023-12-28 17:08:26.763350 INFO AppDaemon: /config/apps/test/test.yaml added or modified
2023-12-28 17:08:26.823541 INFO AppDaemon: App 'test' deleted
2023-12-28 17:08:26.828439 INFO AppDaemon: Found 61 active apps
2023-12-28 17:08:26.828826 INFO AppDaemon: Found 0 inactive apps
2023-12-28 17:08:26.829435 INFO AppDaemon: Found 0 global libraries

An update, in case this helps.

It seems to me like I get the warning about secrets whenever there is an app with it’s yaml config commented out, and that config contains a reference to secret (e.g., the test.yaml in the logs in previous post).

Does that explain this and/or is that expected? I thought it would just ignore apps with yaml commented out?

Yeah, commented YAML is not looked at so this doesn’t really make any sense.