Repository navigation
get_domains() fails with ValidationError after Home Assistant 2025.11 release #217
Description
Activity
Any updates on this? Just curious as im kinda stuck and seems like no work around. :)
I started trying to dig into this. I can't even find the docs updates for the new behavior.
Here's the actual implementation file in Home Assistant, which hasn't been updated in 5 months: https://github.com/home-assistant/core/blame/dev/homeassistant/components/api/__init__.py
And the deployed docs page hasn't been updated in 2 months and doesn't contain any of this info AFAIK: https://github.com/home-assistant/developers.home-assistant/blame/master/docs/api/rest.md
And the REST API dev docs has a simple SWAGGER tool that also doesn't define parameters (or outputs):
https://developers.home-assistant.io/docs/api/rest/Am I just missing something? Or does someone understand this a little better than me? I can definitely reproduce the issue by upgrading. I just don't see why this is the only project affected or what proper procedures are expected
Edit: I think it might be related to this => home-assistant/core#147120
This also has a dev blog post: https://developers.home-assistant.io/blog/2025/10/24/service-web-api-changes/
The
Servicemodel inhomeassistant_api/models/domains.pyshould be updated to make the name field optional, or provide a default value when it's missing from the API response. This would maintain backward compatibility while handling the new API format.It seems like name is indeed optional in the official Service schema so I agree it should be just an easy fix.
- linked a pull request that will close this issueMake `Service.name` an optional field #218
on Nov 11, 2025 - Reacted by kilian579
I am facing a very related issue with Home Assistant 2025.12. and the
get_domains()call:pydantic_core._pydantic_core.ValidationError: 4 validation errors for Service fields.file.ServiceField.selector.media.multiple Extra inputs are not permitted [type=extra_forbidden, input_value=False, input_type=bool] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden fields.file.ServiceFieldCollection.fields Field required [type=missing, input_value={'required': True, 'selec...'], 'multiple': False}}}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing fields.file.ServiceFieldCollection.required Extra inputs are not permitted [type=extra_forbidden, input_value=True, input_type=bool] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden fields.file.ServiceFieldCollection.selector Extra inputs are not permitted [type=extra_forbidden, input_value={'media': {'accept': ['im...*'], 'multiple': False}}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbiddenI could not find information on changes though.
Steps to reproduce are exactly as originally outlined.@GrandMoff100 can this be reopened or should I create a new issue?
Upgraded last night to find out all my scripts are broken.
Version info
Installation method Home Assistant OS Core 2025.12.3 Supervisor 2025.12.3 Operating System 16.3 Frontend 20251203.2Traceback output
Traceback (most recent call last): File "/home/konetzed/venv/ha/shed_lights.py", line 18, in <module> switch = client.get_domain("switch") File "/home/konetzed/venv/ha/lib/python3.13/site-packages/homeassistant_api/rawclient.py", line 288, in get_domain return self.get_domains().get(domain_id) ~~~~~~~~~~~~~~~~^^ File "/home/konetzed/venv/ha/lib/python3.13/site-packages/homeassistant_api/rawclient.py", line 281, in get_domains return {domain.domain_id: domain for domain in domains} ^^^^^^^ File "/home/konetzed/venv/ha/lib/python3.13/site-packages/homeassistant_api/rawclient.py", line 278, in <lambda> lambda json: Domain.from_json(json, client=cast(Client, self)), ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/konetzed/venv/ha/lib/python3.13/site-packages/homeassistant_api/models/domains.py", line 68, in from_json domain._add_service(service_id, **data) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ File "/home/konetzed/venv/ha/lib/python3.13/site-packages/homeassistant_api/models/domains.py", line 76, in _add_service service_id: Service( ~~~~~~~^ service_id=service_id, ^^^^^^^^^^^^^^^^^^^^^^ domain=self, ^^^^^^^^^^^^ **data, ^^^^^^^ ) ^ File "/home/konetzed/venv/ha/lib/python3.13/site-packages/pydantic/main.py", line 250, in __init__ validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 5 validation errors for Service fields.media.ServiceField.selector.media.multiple Extra inputs are not permitted [type=extra_forbidden, input_value=False, input_type=bool] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden fields.media.ServiceFieldCollection.fields Field required [type=missing, input_value={'required': True, 'selec...ontent_type": "music"}'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing fields.media.ServiceFieldCollection.required Extra inputs are not permitted [type=extra_forbidden, input_value=True, input_type=bool] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden fields.media.ServiceFieldCollection.selector Extra inputs are not permitted [type=extra_forbidden, input_value={'media': {'multiple': False}}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden fields.media.ServiceFieldCollection.example Extra inputs are not permitted [type=extra_forbidden, input_value='{"media_content_id": "ht...content_type": "music"}', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbiddenCurrently on HomeAssistant-API 5.0.2.post1
Core 2025.12.3 Supervisor 2025.12.3 Operating System 16.3 Frontend 20251203.2 HomeAssistant-API 5.0.2.post1Both get_domains() and get_domain() fail
service = client.get_domains() ^^^^^^^^^^^^^^^^^ File "C:\Users\user\Documents\dev\Python\RpiDash\RpiDash\Lib\site-packages\homeassistant_api\rawclient.py", line 281, in get_domains return {domain.domain_id: domain for domain in domains} ^^^^^^^ File "C:\Users\user\Documents\dev\Python\RpiDash\RpiDash\Lib\site-packages\homeassistant_api\rawclient.py", line 278, in <lambda> lambda json: Domain.from_json(json, client=cast(Client, self)), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\Documents\dev\Python\RpiDash\RpiDash\Lib\site-packages\homeassistant_api\models\domains.py", line 68, in from_json domain._add_service(service_id, **data) File "C:\Users\user\Documents\dev\Python\RpiDash\RpiDash\Lib\site-packages\homeassistant_api\models\domains.py", line 76, in _add_service service_id: Service( ^^^^^^^^ File "C:\Users\user\Documents\dev\Python\RpiDash\RpiDash\Lib\site-packages\pydantic\main.py", line 250, in __init__ validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pydantic_core._pydantic_core.ValidationError: 5 validation errors for Service fields.media.ServiceField.selector.media.multiple Extra inputs are not permitted [type=extra_forbidden, input_value=False, input_type=bool] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden fields.media.ServiceFieldCollection.fields Field required [type=missing, input_value={'required': True, 'selec...ontent_type": "music"}'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing fields.media.ServiceFieldCollection.required Extra inputs are not permitted [type=extra_forbidden, input_value=True, input_type=bool] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden fields.media.ServiceFieldCollection.selector Extra inputs are not permitted [type=extra_forbidden, input_value={'media': {'multiple': False}}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden fields.media.ServiceFieldCollection.example Extra inputs are not permitted [type=extra_forbidden, input_value='{"media_content_id": "ht...content_type": "music"}', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden```Hi guys! @LukeBoland @konetzed @scheidtdav Sorry, I've been caught up with finals and Christmas, but one temporary workaround that seems to work is to modify the model config at runtime
from homeassistant_api.models.base import BaseModel BaseModel.model_config.pop("extra", None)
Home Assistant seems to changed the schema of service models on us and I will try to work on it over the holidays.
Please let me know if this workaround works for y'all, and I just ask for your patience.
I think I've fixed it. It seems like just an extra
multipleflag insideServiceFieldSelectorMediadid the trick?Reacted by Edward Konetzko and David ScheidtTested and my scripts are working after upgrade to HomeAssistant-API-5.0.2.post2, TYVM!
Reacted by Nathan LarsenMerry Christmas!
Reacted by David Scheidt
Description
After upgrading to Home Assistant 2025.11 (released November 5, 2025), the
client.get_domains()method fails with a Pydantic validation error. This appears to be caused by changes in the Home Assistant REST API response format where some services are missing the requirednamefield.Environment
Steps to Reproduce
Error Message
Expected Behavior
The
get_domains()method should successfully return a dictionary of all available domains and their services, which I use to access available fields and functions of my devices.Actual Behavior
The method raises a
ValidationErrorbecause the PydanticServicemodel requires anamefield that is apparently missing from some services in the Home Assistant 2025.11 REST API response.Analysis
It appears that Home Assistant 2025.11 has changed the format of service definitions returned by the REST API. Some services (like
save_persistent_statesbased on the error context) no longer include thenamefield that the library's Pydantic model expects.This is likely related to the extensive automation editor improvements and API changes mentioned in the [2025.11 release notes](https://www.home-assistant.io/blog/2025/11/05/release-202511/).
Proposed Solution
The
Servicemodel inhomeassistant_api/models/domains.pyshould be updated to make thenamefield optional, or provide a default value when it's missing from the API response. This would maintain backward compatibility while handling the new API format.Workaround
None currently available. The
get_domains()method is completely broken after upgrading Home Assistant to 2025.11.Additional Context
trigger_service()method still works correctly for controlling devicesget_domains()method appears to be affectedget_entity()appear to work when called with theentity_idkeyword argument