VW EU Data Act: Retry-After is ignored and failed updates are cached for the full cache interval
Describe the bug
The VW EU Data Act endpoint rate-limits burst requests with HTTP 429 and supplies a Retry-After header. The provider does not evaluate this header.
More importantly, eudataact.NewProvider() logs an error returned by store.update(), but then returns the existing snapshot with a nil error. The cache therefore treats the failed update as successful. Since the dataset-based reset is only scheduled after a successful update, the stale or partially populated snapshot remains cached for the full configured vehicle cache interval (15 minutes in this configuration), even when Retry-After only requests a delay of a few seconds.
An initial update can issue an identifier request, a dataset-list request and up to eight backfill downloads in rapid succession. If one download receives 429, the loop stops. Data downloaded before the error is retained in memory, but the resulting partial snapshot is then cached as a successful update.
Expected behavior:
- Honor
Retry-Afteron HTTP 429. - Do not turn a failed update into a successful full-duration cache fill.
- Continue serving the last valid snapshot, but schedule a separate retry after the server-provided delay, preferably with jitter.
- Preserve already downloaded datasets and continue from the high-water mark on retry.
Steps to reproduce
- Start evcc with a VW EU Data Act vehicle and no existing in-memory store state.
- Let the initial provider update request the identifier, dataset list and backfill datasets.
- Have the portal return HTTP 429 with
Retry-Afterduring the download loop. This can also be reproduced in a test using a mocked 429 response. - Observe that the update error is only logged and
snapshot(vin), nilis returned. - Observe that no retry is scheduled using
Retry-Afterand the partial or stale snapshot remains cached for the full vehicle cache duration.
Configuration details
vehicle
---
db:2 {Type:template Product:Volkswagen We Connect ID} map[autodetectdisabled:false cache:15m capacity:58 template:vw title:VW ID.3 timeout:10s]
The issue is independent of the charger and loadpoint configuration. The relevant cache duration is 15m.
Log details
Controlled requests to the authenticated VW EU Data Act dataset-list endpoint returned the following rate-limit behavior.
Single request:
HTTP 200
RateLimit-Limit: 5
RateLimit-Remaining: 4
Ten requests at one-second intervals in the same authenticated session:
1: HTTP 200, RateLimit-Remaining: 4
2: HTTP 200, RateLimit-Remaining: 3
3: HTTP 200, RateLimit-Remaining: 2
4: HTTP 200, RateLimit-Remaining: 4
5: HTTP 200, RateLimit-Remaining: 0
6: HTTP 200, RateLimit-Remaining: -1
7: HTTP 200, RateLimit-Remaining: 1
8: HTTP 429, Retry-After: 5
9: HTTP 429, Retry-After: 16
10: HTTP 429, Retry-After: 15
The inconsistent `RateLimit-Remaining` values should not be used for client-side scheduling. `Retry-After` is present on the actual 429 responses and is currently ignored by evcc.
What type of operating system or environment does evcc run on?
Docker container
External automation
- [x] I have made sure that no external automation like HomeAssistant or Node-RED is active or accessing any of the mentioned devices when this issue occurs.
Nightly build
- [x] I have verified that the issue is reproducible with the latest nightly build
Version
0.314.0-dev+6bf587097
Investigated and can confirm the root cause in code.
eudataact.NewProvider() unconditionally swallows the update error:
cached = util.ResettableCached(func() ([]point, error) {
ts, err := s.update(vin)
if err != nil {
log.ERROR.Println(err)
} else if !ts.IsZero() {
time.AfterFunc(resetDelay(ts, cache), cached.Reset)
}
return s.snapshot(vin), nil // always nil error
}, cache)
(vehicle/vw/eudataact/provider.go:38-46)
Since the wrapped getter always returns a nil error, util.Cached's backoff/retry logic in util/cache.go (mustUpdate, shouldRetryWithBackoff) never triggers — a failed store.update() (e.g. a 429 during the backfill loop in store.go:110) is cached as a success for the full configured cache duration, and no AfterFunc reset is scheduled because that only happens in the err == nil branch.
Separately, util/request has no Retry-After handling at all, so even where retries do occur they are not paced by the server-provided delay.
Both match the report. This looks like a genuine, confirmed defect, but a proper fix touches several concerns (propagating a distinguishable failure without discarding the last-good snapshot, honoring Retry-After with jitter, and preserving the high-water mark across a partial backfill) — it needs a design decision on how to expose "stale but valid" vs. "still updating" to the cache layer, so I'm not attempting an automated fix here.
🤖 Generated with Claude Code
Ten requests at one-second intervals in the same authenticated session:
Where do these requests even come from? This shouldn't be the case. Please provide logfile.
The relevant evcc-side request pattern is the initial provider update visible in the code:
identifier()once while the identifier is unknowndatasets()once- up to
maxBackfill = 8synchronousdownload()calls for pending datasets
There is no intentional pacing between those calls. Therefore a fresh in-memory store can issue up to ten portal requests in one update, although I am not claiming they occur at exactly one-second intervals. The controlled series only demonstrates that actual 429 responses carry Retry-After, which evcc currently ignores.
The evcc instance did log HTTP 429 errors during EU Data Act dataset downloads, including directly after a restart. Unfortunately that container was later recreated and the old complete log is no longer retained, so I cannot provide the original full trace now without reproducing it again.
The caching defect itself does not depend on why or at what request rate the 429 occurs: any error returned by s.update(vin) is logged, converted to snapshot(vin), nil, and consequently cached as a successful refresh for the full cache interval. This is also what the automated code analysis above confirmed.
Please provide logfile.
AI-dumped responses can't replace a log for drawing your own conclusions. Closing until log available.