A target is `UP` but `/targets` shows `expected a valid start token, got "<" ("INVALID") while parsing: "<"`
IntermediateTroubleshootingPrometheus scraping and targets
Answer
Likely causes → The path returns HTML (login page, 404 page, SPA index) instead of exposition format. Usually wrong metrics_path or an auth proxy redirect.
Diagnose →
curl -sL http://app:8080/metrics | head -5
curl -sI http://app:8080/metrics # look for 302 to /login
Fix → Point metrics_path at the real endpoint (/actuator/prometheus for Spring Boot, /metrics for most others), or exempt it from the auth proxy.
Prevent → Add a smoke test that runs promtool check metrics against the endpoint in CI.
More on Prometheus scraping and targets
A target shows `DOWN` on `/targets` with `Get "http://10.0.3.14:9100/metrics": context deadline exceeded`BeginnerTarget is `DOWN` with `server returned HTTP status 401 Unauthorized`BeginnerTarget shows `server returned HTTP status 403 Forbidden` when scraping kubelet / cAdvisorIntermediateTarget is `DOWN` with `connect: connection refused`BeginnerTarget shows `x509: certificate signed by unknown authority`IntermediateTarget shows `x509: certificate is valid for app.svc, not 10.0.4.22`Intermediate