Skip to content

Fix Hetzner 404 error detection during server destruction#152

Open
cvetkovski98 wants to merge 1 commit into
drone:masterfrom
cvetkovski98:fix/hetzner-destroy-check-error-code
Open

Fix Hetzner 404 error detection during server destruction#152
cvetkovski98 wants to merge 1 commit into
drone:masterfrom
cvetkovski98:fix/hetzner-destroy-check-error-code

Conversation

@cvetkovski98

@cvetkovski98 cvetkovski98 commented Mar 10, 2026

Copy link
Copy Markdown

The Reaper component is unable to properly clean up errored Hetzner servers because 404 errors when destroying non-existent servers are not correctly detected. The current implementation relies on checking human-facing error messages, which are fragile and subject to change.

When the Reaper attempts to destroy an errored server that no longer exists on Hetzner, the 404 response is not recognized as autoscaler.ErrInstanceNotFound. This prevents the Reaper from correctly marking the server as stopped, causing it to remain in the error state indefinitely.

Use the Hetzner Cloud SDK's machine-facing error code detection (hcloud.IsError(err, hcloud.ErrorCodeNotFound)). The machine facing error code is documented in the Hetzner API reference. This provides a stable, version-independent way to detect not-found errors and properly classify them as autoscaler.ErrInstanceNotFound.

This should:

  • Enable the Reaper to correctly handle scenarios where servers have been manually terminated outside the autoscaler
  • Prevents errored servers from becoming stuck in the error state
  • Improves reliability of cleanup operations for Hetzner cloud instances

Alternative to: #121

Edit: Improved PR title and description.

@cvetkovski98 cvetkovski98 changed the title Use hcloud error code for not-found detection Fix Hetzner 404 error detection during server destruction Mar 11, 2026
@dewan-ahmed

Copy link
Copy Markdown

Hi @cvetkovski98 thanks for the contribution. We don’t have a committed timeline for merging this upstream right now. If you need this in the near term, maintaining a fork is the best path forward. We appreciate the work you’ve put into this, and if this area aligns with our roadmap down the line, we’ll revisit it for potential inclusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants