Config check failing on 2 systems going from 2021.11.5 to 2021.12.1

I am getting the same error on 2 systems, 1 an RPi 4 running native Home Assistant and the second running Debian 11 with a supervised install.

Fatal error while loading config: function() argument 'code' must be code, not str
Failed config
  General Errors: 
    - function() argument 'code' must be code, not str

After checking the log file for config checker I have found a little more info…

INFO:homeassistant.util.package:Attempting install of wrapt~=1.12.1
Fatal error while loading config: function() argument 'code' must be code, not str
Failed config
  General Errors: 
    - function() argument 'code' must be code, not str

I see this is a python module. I could see it failing on the Debian 11 supervised box, but not on the native RPi 4.

I have also posted this question on r/homeassistant.

Any ideas?

Have you update Alexa media player? Are you using any custom integration that relies on http for python?

Both systems are running Alexa Media Player 3.10.10, this appears to be the latest. At the moment, everything is on the latest version as far as I can tell.

I am not sure how to find the answer to the last question… can you point me in the right direction?

Does this help?

System Health

version: core-2021.11.5
installation_type: Home Assistant Supervised
dev: false
hassio: true
docker: true
user: root
virtualenv: false
python_version: 3.9.7
os_name: Linux
os_version: 5.10.0-9-amd64
arch: x86_64
timezone: America/Chicago


GitHub API: ok
Github API Calls Remaining: 4993
Installed Version: 1.18.0
Stage: running
Available Repositories: 912
Installed Repositories: 13


host_os: Debian GNU/Linux 11 (bullseye)
update_channel: stable
supervisor_version: supervisor-2021.12.1
docker_version: 20.10.11
disk_total: 218.1 GB
disk_used: 15.8 GB
healthy: true
supported: true
supervisor_api: ok
version_api: ok
installed_addons: Backup Hassio to Google Drive (1.7.2), Dropbox Sync (1.3.0), Duck DNS (1.14.0), File editor (5.3.3), Log Viewer (0.12.1), RPC Shutdown (2.2), WireGuard (0.6.0), Mosquitto broker (6.0.1), SSH & Web Terminal (9.1.1), Samba share (9.5.1), TasmoAdmin (0.16.0), Glances (0.14.0), Check Home Assistant configuration (3.9.0), DHCP server (1.2), Network UPS Tools (0.9.0), Samba Backup (5.0.0), Node-RED (10.2.0), Portainer (2.0.0), SDR to Home Assistant (0.1.6b), Home Assistant Google Drive Backup (0.105.2)


dashboards: 1
resources: 6
views: 15
mode: storage

I see that there is a newer version of Alexa Media Player, 3.10.15. But, the docs say that you must be running 2021.12.0b0 to install it.

Ok, so it looks like I need to go ahead and update HA and then update Alexa Media Player? I am just concerned that I could end up in a non-booting state.

I went ahead and installed 2021.12.1 and waited for the reboot to finish and then updated Alexa Media Player to 3.10.15. This required a reboot, the system would not reboot as it presents the error message in the lower corner about “code”. The supervisor panel would not load either, just sat with a spinning ring.

I did a full restore at the CLI of my full backup from 2021.11.5 and I am back and running.

What in the world am I missing?

You have to update alexa media player and home assistant. Config check will fail if alexa media player is not up to date. There’s really nothing more to it. You may need to force restarts using SSH.

apparently pushover is another one that needs updating. Just update all your custom integrations.

I have the same issue.
And I do use Alexa media player

The system states that everything is up to date.
But cannot update to latest version of HA core

And how are you checking to see if alexa media player is up to date? The only solution to this or any of these function() argument 'code' must be code, not str is to remove or update the integration that uses an outdated http dependency. If you don’t know what that means, remove all custom integrations and update. Then add all custom integrations back in one by one.

1 Like

Thanks for the suggestion. I will give it a go

Thanks, updated HA, rebooted, updated AMP in HACS and rebooted via the CLI. All good now.