Skip to content

HTTP 410 Gone on webhook does not trigger device re-registration #6722

@loganrosen

Description

@loganrosen

Version

  • App: 2026.3.2-full
  • Android: 16 (SDK 36)
  • Phone: Pixel 9 Pro XL

Description

When a server's webhook ID becomes invalid (HA returns HTTP 410 Gone), the app does not attempt to re-register the device. It silently keeps using the dead webhook ID, causing all webhook-based operations (update_location, get_zones, update_sensor_states, etc.) to fail permanently until the user manually removes and re-adds the server.

Root cause

In IntegrationRepositoryImpl.updateRegistration() (line 160-184), there is logic to detect a broken registration and re-register:

if (response.code() == 200 && response.body()?.contentLength() == 0L) {
    // Reregistration logic
}

However, this only handles the case of a 200 with an empty body. A 410 Gone response is thrown as an HttpException by Retrofit before the onSuccess handler runs, so the re-registration logic is never reached.

Meanwhile, callWebhookOnUrls() in tryOnUrls() catches the 410 and moves on to the next URL. If all URLs return 410, it throws IntegrationException("All URLs failed"). At no point is re-registration attempted.

Impact

The app gets permanently stuck with a dead webhook. In my case:

  • The webhook ID was invalidated at some point (possibly during an HA update or config entry cleanup)
  • Every get_zones, update_location, and update_sensor_states call returned 410 Gone
  • Location tracking was completely broken for days
  • The only fix was manually removing and re-adding the server in the app

Combined with #6721 (multi-server geofence failure), this made location tracking silently broken with no user-visible indication.

Expected behavior

When the app receives HTTP 410 Gone on a webhook call, it should:

  1. Recognize that the webhook registration is invalid
  2. Attempt to re-register the device with the server (call registerDevice())
  3. If re-registration succeeds, persist the new webhook ID and retry the original request
  4. If re-registration fails, surface an error to the user (persistent notification, sensor status, etc.)

Logs

W ServerConnectionStateProviderKt: Failed get_zones on HIDDEN
W ServerConnectionStateProviderKt: retrofit2.HttpException: HTTP 410 Gone
E LocationSensorManager: Error receiving zones from Home Assistant
E LocationSensorManager: IntegrationException: All URLs failed for get_zones

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions