jaegertracing/jaeger · error
failed to find latest index
Error message
failed to find latest index
What it means
In internal/storage/v1/elasticsearch/samplingstore/storage.go, getLatestProbabilities calls getLatestIndex, which walks candidate index names (checking each with an existence check) and returns errors.New("failed to find latest index") when none of the candidate indices exists. This typically means the adaptive-sampling indices were never written by a jaeger-collector/remote-storage with adaptive sampling enabled, or the index naming/date pattern does not match what was actually created.
Source
Thrown at internal/storage/v1/elasticsearch/samplingstore/storage.go:177
Timestamp: ts,
ProbabilitiesAndQPS: pandqps,
},
}})
}
func (s *SamplingStore) getLatestIndex(ctx context.Context) (string, error) {
now := s.now().UTC()
candidates := s.rotation.ReadTargets(now.Add(-s.lookback), now)
for _, idx := range candidates {
exists, err := s.indexClient.IndexExists(ctx, idx)
if err != nil {
return "", fmt.Errorf("failed to check index existence: %w", err)
}
if exists {
return idx, nil
}
}
return "", errors.New("failed to find latest index")
}
func buildTSQuery(start, end time.Time) query.Query {
return query.NewRangeQuery("timestamp").Gte(start).Lte(end)
}
View on GitHub (pinned to 806f444784)
Solutions
- Verify sampling indices exist: list indices matching the jaeger sampling prefix (e.g. jaeger-sampling-*) in the cluster and confirm data was written.
- Ensure a collector/remote-storage with adaptive sampling enabled is writing sampling data; without a writer the index never appears.
- Check that the storage index prefix/date-layout configuration matches between the component that writes and the one reading (jaeger.index-prefix, date format).
- Confirm cluster clocks/timezone are correct and retention policies (ILM) have not deleted the recent sampling indices.
- Handle the error gracefully in the caller by falling back to default probabilities until the first index is published.
Example fix
// before
probs, err := store.GetLatestProbabilities()
// after
probs, err := store.GetLatestProbabilities()
if errors.Is(err, ErrNoIndices) || strings.Contains(err.Error(), "failed to find latest index") {
probs = defaultProbabilities // fall back until collector publishes sampling data
} Defensive patterns
Strategy: fallback
Validate before calling
// before querying: check indices exist
exists, err := client.IndexExists(indexPrefix + "-*").Do(ctx)
if err != nil || !exists {
return nil, errors.New("no sampling indices present; adaptive sampling writer not running?")
} Try / catch
probs, err := store.GetLatestProbabilities()
if err != nil && strings.Contains(err.Error(), "failed to find latest index") {
probs = defaultProbabilities // serve defaults and retry later
} Prevention
- Run a collector/remote-storage with adaptive sampling enabled so the index is populated before readers start.
- Keep index prefix and date-format config identical across writer and reader components.
- Monitor for sampling indices and alert when none exist within the expected window.
- Verify retention/ILM policies do not delete recent sampling indices.
When it happens
Trigger: GetLatestProbabilities (via getLatestIndex) runs when no index matching the jaeger-sampling index prefix/date pattern exists in the ES cluster — the existence check for every candidate index returned false.
Common situations: Fresh Elasticsearch/OpenSearch cluster with no collector writing sampling data yet; sampling index prefix/date format mismatch between writer and reader (e.g. changed index prefix in config, ILM rollover/retention deleting old indices); clock skew or wrong timezone shifting the candidate date list away from existing indices.
Related errors
- failed to get latest index: %w
- failed to search for throughputs: %w
- unmarshalling documents failed: %w
- trace ID from DB is too long: %d chars
- span ID from DB is too long: %d chars
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/667c18c2243c6f6b.
Report an issue: GitHub.