# Self-Healing CI: Recovering a Flapping Service Container Healthcheck

> A service container whose healthcheck flaps before settling is a startup-stabilization issue, not a broken service. See the manual fix and how self-healing CI waits and retries.

Source: https://latchkey.dev/learn/self-healing-ci/self-healing-service-container-healthcheck-flap  
Updated: 2026-06-26

A healthcheck that flaps unhealthy then healthy during startup is a service still stabilizing, not a broken dependency -- waiting for it to settle clears it.

## What makes a failure safely retryable

Automatic retry is only correct for failures that are genuinely transient. Retrying a deterministic failure wastes minutes and hides a real defect, so the classification matters more than the retry mechanism.

- Safe to retry: network timeouts, registry 5xx, transient DNS failures, a service container that was not ready, a spot instance reclaimed mid-run.
- Not safe to retry: assertion failures, compile errors, lint violations, anything that fails identically on every attempt.
- Ambiguous, and worth investigating rather than retrying: out-of-memory kills, disk exhaustion, and flaky tests. These repeat under load and a retry only hides the trend.
- Always record that a retry happened. A pipeline that silently retries is a pipeline whose real failure rate you do not know.

## FAQ

### What causes Self-Healing CI: recovering a flapping service container healthcheck?

A job fails because a service container was marked unhealthy at the moment the dependent step started, even though its healthcheck flaps and settles healthy moments later. The service is fine; its healthcheck oscillated during startup stabilization. A human re-runs or waits for the healthcheck to settle and the step passes unchanged.

### How do I fix Self-Healing CI: recovering a flapping service container healthcheck manually?

[object Object]

### Can Self-Healing CI: recovering a flapping service container healthcheck be fixed automatically?

A flapping healthcheck during startup is distinguishable from a persistently failing one by whether it settles healthy shortly after. A self-healing CI pipeline detects the unhealthy-at-start condition, waits for the healthcheck to stabilize and re-checks, and only escalates if the service stays unhealthy, which is the real signal of a

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
