REST integrations suddenly failing after upgrade to OS 14.2 / Core 2025.1.4

I have had a bunch of REST integrations set up for at least a year now, and they’ve been working great until this week, when I upgraded my HA to OS 14.2 and Core 2025.1.4. Now, upon startup, all of my REST integrations fail with the error below. It doesn’t depend on the specific integration or REST sensor. I’ve tried removing all of them, and then re-adding them one-at-a-time, and all of them fail in the same way.

The error in the UI is:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 416, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/rest/__init__.py", line 92, in async_setup
    return await _async_process_config(hass, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/rest/__init__.py", line 113, in _async_process_config
    rest = create_rest_data_from_config(hass, conf)
  File "/usr/src/homeassistant/homeassistant/components/rest/__init__.py", line 212, in create_rest_data_from_config
    raise HomeAssistantError("Resource not set for RestData")
homeassistant.exceptions.HomeAssistantError: Resource not set for RestData

The raw logs are not helpful. In addition to the Python traceback above, there’s only a single error line stating:

2025-02-01 17:28:32.399 ERROR (MainThread) [homeassistant.setup] Error during setup of component rest

If I restore to my last-known-good backup, all of my REST sensors come back and work fine. But as soon as I REBOOT, we go back to the failure mode above, even if I haven’t updated anything. Removing all of my REST sensors and re-adding them doesn’t seem to help. I literally have to restore the last backup to restore REST functionality.

Totally baffled on what could possibly be the problem here, and any advice or places to look would be appreciated.

For reference, here’s one of the REST integrations. But I can’t imagine that it’s the integration config that’s the problem, since as noted, this has been working for a long long time, and works after restoring backup (until the next reboot):

  - resource: "https://api.weather.gov/products/types/AFD/locations/CLE"
    scan_interval: 3600
    sensor:
    - name: "NWS KCLE Forecast Discussion URL"
      value_template: "{{ value_json['@graph'][0]['@id'] }}"
      unique_id: "nws_kcle_forecast_discussion_url"
    - name: "NWS KCLE Forecast Discussion Issuance Time"
      value_template: "{{ value_json['@graph'][0]['issuanceTime'] }}"
      unique_id: "nws_kcle_forecast_discussion_time"

UPDATE: I’ve figured out what’s causing this, though not why this behavior seems to have changed starting with the 2025.1.4 update. It turns out that it’s a REST sensor with a resource_template value that depends on another REST sensor.

Here’s the situation. I have a REST sensor with a template value of the following:

  - resource_template: "{% if states('sensor.nws_kcle_forecast_discussion_url') and states('sensor.nws_kcle_forecast_discussion_url') != 'unavailable' %}{{ states.sensor.nws_kcle_forecast_discussion_url.state }}{% else %}https://api.weather.gov/products/types/AFD/locations/CLE{% endif %}"
    scan_interval: 3600
    sensor:
    - name: "NWS KCLE Forecast Discussion"
      value_template: "{{ value_json['id'] }}"
      unique_id: "nws_kcle_forecast_discussion"
      json_attributes:
        - "productText"
        - "productName"
        - "wmoCollectiveId"

That template actually works fine. IF the REST sensor which defines the nws_kcle_forecast_discussion_url sensor exists. However, after a hard reboot of Home Assistant, there is now some kind of sequencing issue that did not happen before, where at the time the system starts, it attempts to load this REST sensor with the resource template requirement BEFORE the prior REST sensor that defines that JSON value has executed.

In 2024.12.x this works fine. Starting with 2025.1.4, this now fails. That’s why my backup restorations were working.

If I manually remove the resource_template -based sensors, restart, and then re-add them and use Developer Tools to reload “REST Entities and Notify Services”, then magically everything works. So it’s not that the overall setup is invalid. It’s that for some reason there is now a sequencing/race-condition problem where it’s trying to load the sensor before the values for the resource-template are available.

Also, for whatever reason, once that fails, it’s “stuck” failing. Just resetting REST sensors in Developer Tools won’t work. The sensors have to be removed from the configuration, reset, and then re-added to the configuration to work again.

I’ve looked at the HA code in GitHub and haven’t been able to find a change that is obviously responsible for this, but race conditions and timing issues during load are nasty problems at the best of times…

Continuing to play with this, and can now state that whatever timing/load issue is present with REST sensors, it appears to affect essentially anything except a static URL.

Any REST sensor that has just a fixed resource value seems to load fine. The issue is with resource_template-based sensors. If that template draws on a value from a Helper, another REST sensor, or any other value within Home Assistant that needs to be de-referenced, instead of just a static string, it pretty reliably fails since 2025.1.4. In addition to the “Resource not set for RestData” error, it will throw:

2025-02-28 16:33:20.425 ERROR (MainThread) [homeassistant.components.rest.data] Error fetching data: unavailable failed with Request URL is missing an 'http://' or 'https://' protocol.
2025-02-28 16:33:20.675 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform 'rest.sensor': Unable to set up component.

… and that second message will repeat many many times in the logs. The Template helper in Developer Tools will show that the template is working, and a valid URL is returned. But that is after the UI has loaded and is available for navigation. The REST sensors are clearly trying to reference these values before some critical component has fully started.

(Note: As with before, if you remove all resource_template-based REST sensors, reboot the system, and then add them back in after the system is fully up, everything works fine. It’s only if those sensors are in the configuration during a reboot when everything dies. Once it dies, just reloading the YAML from within Developer Tools does nothing… even if you remove the sensors from the config, it still fails with the above messages. You have to remove them from the configuration, fully REBOOT, and then re-add them for it to work.)