Errors during startup (ValueError: list.remove(x): x not in list)
See original GitHub issueBefore you submit a new bug report, please check that
- I have read frequently asked questions and limitations
- I’m running the newest version of Garbage Collection, or the next pre-release.
- I have enabled debug logging for my installation.
Describe the bug
During startup from ha there are ERROR log entries from the automation move_on_holiday ValueError: list.remove(x): x not in list
But the garbage collection calendar looks ok.
Configuration
{
"home_assistant": {
"installation_type": "Home Assistant OS",
"version": "2022.2.9",
"dev": false,
"hassio": true,
"virtualenv": false,
"python_version": "3.9.7",
"docker": true,
"arch": "aarch64",
"timezone": "Europe/Zurich",
"os_name": "Linux",
"os_version": "5.10.92-v8",
"supervisor": "2022.01.1",
"host_os": "Home Assistant OS 7.4",
"docker_version": "20.10.9",
"chassis": "embedded",
"run_as_root": true
},
"custom_components": {
"holidays": {
"version": "1.6",
"requirements": [
"python-dateutil>=2.8.1",
"holidays>=0.12"
]
},
"garbage_collection": {
"version": "4.5",
"requirements": [
"python-dateutil>=2.8.2"
]
},
"hacs": {
"version": "1.22.0",
"requirements": [
"aiogithubapi>=21.11.0"
]
},
"gardena_smart_system": {
"version": "0.2.3",
"requirements": [
"py-smart-gardena==0.7.10"
]
},
"variable": {
"version": "0.0",
"requirements": []
},
"xiaomi_miot": {
"version": "0.5.3",
"requirements": [
"construct==2.10.56",
"python-miio>=0.5.6",
"micloud>=0.3"
]
},
"rocketlaunchlive": {
"version": "009",
"requirements": [
"rocketlaunchlive==0.0.2"
]
},
"meteo-swiss": {
"version": "1.3",
"requirements": [
"hamsclient==0.2"
]
}
},
"integration_manifest": {
"domain": "garbage_collection",
"name": "Garbage Collection",
"version": "4.5",
"documentation": "https://github.com/bruxy70/Garbage-Collection/",
"issue_tracker": "https://github.com/bruxy70/Garbage-Collection/issues",
"iot_class": "calculated",
"dependencies": [],
"config_flow": true,
"codeowners": [
"@bruxy70"
],
"requirements": [
"python-dateutil>=2.8.2"
],
"is_built_in": false
},
"data": {
"entity_id": "sensor.grunabfuhr",
"state": "tomorrow",
"attributes": {
"next_date": "2022-02-21T00:00:00+01:00",
"days": 1,
"last_collection": null,
"last_updated": "2022-02-20T09:12:30.771096+01:00",
"device_class": "garbage_collection__schedule"
},
"config_entry": {
"entry_id": "76e9a645458a069f2af3a9e09bce68bc",
"version": 4.5,
"domain": "garbage_collection",
"title": "Gr\u00fcnabfuhr",
"data": {
"unique_id": "ae191b37-249f-46b1-8f6c-7e3e847d95a4",
"frequency": "every-n-weeks",
"icon_normal": "mdi:trash-can",
"icon_today": "mdi:delete-restore",
"icon_tomorrow": "mdi:delete-alert",
"expire_after": "08:00",
"verbose_state": true,
"verbose_format": "am {date}, in {days} Tagen",
"date_format": "%d.%m.%y",
"collection_days": [
"mon"
],
"first_month": "jan",
"last_month": "dec",
"period": 1,
"first_week": 1,
"manual_update": true
},
"options": {},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"unique_id": null,
"disabled_by": null
}
}
}
Debug logs
2022-02-20 09:11:06 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Grünabfuhr) Calling update
2022-02-20 09:11:06 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Grünabfuhr) Dates loaded, firing a garbage_collection_loaded event
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Grünabfuhr) Calling update
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Grünabfuhr) Dates loaded, firing a garbage_collection_loaded event
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-01-10 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-01-24 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-01-31 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-02-14 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-02-28 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-03-14 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-03-28 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-06-13 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called offset_date 2021-04-05 by 1 days for sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-06-20 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-06-27 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-12-05 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-12-19 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called offset_date 2021-05-24 by 1 days for sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called remove_date 2022-12-26 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called add_date 2022-06-14 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called add_date 2022-06-21 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called add_date 2022-06-28 from sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called update_state for sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Grünabfuhr) Looking for next collection
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Grünabfuhr) next_date (2022-02-21), today (2022-02-20)
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Grünabfuhr) Found next collection date: 21.02.22, that is in 1 days
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called offset_date 2021-11-01 by 1 days for sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called offset_date 2022-04-18 by 1 days for sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called offset_date 2022-06-06 by 1 days for sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called offset_date 2022-08-01 by 1 days for sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called offset_date 2022-08-15 by 1 days for sensor.grunabfuhr
2022-02-20 09:11:16 DEBUG (MainThread) [custom_components.garbage_collection] called offset_date 2022-12-26 by 1 days for sensor.grunabfuhr
2022-02-20 09:11:16 ERROR (MainThread) [homeassistant.components.automation.move_on_holiday] Verschiebe Grünabfuhr: Repeat at step 2: Error executing script. Unexpected error for call_service at pos 2: list.remove(x): x not in list
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 372, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 575, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1630, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1667, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/config/custom_components/garbage_collection/__init__.py", line 146, in handle_offset_date
await entity.remove_date(collection_date)
File "/config/custom_components/garbage_collection/sensor.py", line 548, in remove_date
if self._collection_dates.__contains__(collection_date):
ValueError: list.remove(x): x not in list
2022-02-20 09:11:16 ERROR (MainThread) [homeassistant.components.automation.move_on_holiday] Verschiebe Grünabfuhr: Error executing script. Unexpected error for repeat at pos 2: list.remove(x): x not in list
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 372, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/trace.py", line 252, in async_wrapper
await func(*args)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 705, in _async_repeat_step
await async_run_sequence(iteration, extra_msg)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 687, in async_run_sequence
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 836, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 539, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1253, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 354, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 372, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 575, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1630, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1667, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/config/custom_components/garbage_collection/__init__.py", line 146, in handle_offset_date
await entity.remove_date(collection_date)
File "/config/custom_components/garbage_collection/sensor.py", line 548, in remove_date
if self._collection_dates.__contains__(collection_date):
ValueError: list.remove(x): x not in list
2022-02-20 09:11:16 ERROR (MainThread) [homeassistant.components.automation.move_on_holiday] While executing automation automation.move_on_holiday
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 510, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1253, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 354, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 372, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/trace.py", line 252, in async_wrapper
await func(*args)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 705, in _async_repeat_step
await async_run_sequence(iteration, extra_msg)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 687, in async_run_sequence
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 836, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 539, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1253, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 354, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 372, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 575, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1630, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1667, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/config/custom_components/garbage_collection/__init__.py", line 146, in handle_offset_date
await entity.remove_date(collection_date)
File "/config/custom_components/garbage_collection/sensor.py", line 548, in remove_date
if self._collection_dates.__contains__(collection_date):
ValueError: list.remove(x): x not in list
2022-02-20 09:12:20 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Grünabfuhr) Calling update
2022-02-20 09:12:20 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Grünabfuhr) Dates loaded, firing a garbage_collection_loaded event
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Python throws ValueError: list.remove(x): x not in list
For future reference, the problem with this code is that I looped over the aliens list twice, which causes some issues when trying...
Read more >ValueError: list.remove(x): x not in list - STechies
This error is generated when we try to remove a list item that is not present in the list while using the remove(...
Read more >ValueError: list.remove(x): x not in list (Python) | bobbyhadz
The Python "ValueError: list.remove(x): x not in list" occurs when we call the remove() method with a value that does not exist in...
Read more >list.remove(x): x not in list · Issue #71032 · home-assistant/core
The problem Since 2022.4.6 or 4.7, the following error occasionally appears in the logs: Logger: homeassistant.core Source: core.py:980 ...
Read more >T82493 sphinx_doc_gen.py causes ValueError: list.remove(x)
Short description of error. Running Blender with sphinx_doc_gen.py causes a ValueError: list.remove(x): x not in list. Exact steps for others to reproduce ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I made the new blueprint. Would you like to test it out? https://github.com/bruxy70/Garbage-Collection#public-holidays
I’ve created an automation with the new blueprint. Now I could manage all includes and excludes with this automation, which makes it easier.
And no more exception in the home-assistant.log.
Thank you!