JuliusBrussee/caveman · error

cachebench: observation request %q absent from trace

Error message

cachebench: observation request %q absent from trace

What it means

An observation record references a RequestID that does not exist in the supplied trace, so the exact join cannot be completed. The evaluator looks each record up in the by-ID map built from the trace and fails on the first miss, quoting the orphan ID.

Source

Thrown at cacheengine/cachebench/observed.go:59

	for index, request := range trace {
		if request.Schema != TraceSchema && request.Schema != TraceSchemaV2 || strings.TrimSpace(request.RequestID) == "" {
			return Report{}, fmt.Errorf("cachebench: trace request %d has invalid schema or request_id", index)
		}
		if _, exists := byID[request.RequestID]; exists {
			return Report{}, fmt.Errorf("cachebench: duplicate trace request %q", request.RequestID)
		}
		if strings.TrimSpace(request.Provider) == "" || strings.TrimSpace(request.Epoch) == "" || !validUniqueJSONObject(request.Body) || request.BodySHA256 == "" || request.BodySHA256 != bodyDigest(request.Body) {
			return Report{}, fmt.Errorf("cachebench: trace request %q has invalid identity, body, or digest", request.RequestID)
		}
		if request.StableSegmentCount < 0 || request.StableSegmentCount > len(request.Prefix) || !validPrefix(request.Prefix) {
			return Report{}, fmt.Errorf("cachebench: trace request %q has invalid prefix", request.RequestID)
		}
		byID[request.RequestID] = request
	}
	for _, record := range records {
		request, exists := byID[record.RequestID]
		if !exists {
			return Report{}, fmt.Errorf("cachebench: observation request %q absent from trace", record.RequestID)
		}
		if record.Provider != request.Provider || record.Epoch != request.Epoch {
			return Report{}, fmt.Errorf("cachebench: observation request %q provider/epoch mismatch", record.RequestID)
		}
		if record.RequestBodySHA256 == "" || record.RequestBodySHA256 != request.BodySHA256 {
			return Report{}, fmt.Errorf("cachebench: observation request %q body digest mismatch", record.RequestID)
		}
	}
	report, err := EvaluateObserved(records, target)
	if err != nil {
		return Report{}, err
	}
	report.EvidenceLimitations = append([]string{
		"observation population exactly joined to supplied request trace by request ID and body SHA-256",
	}, report.EvidenceLimitations...)
	return report, nil
}

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Pair the observation file with the trace file from the identical replay run.
  2. Filter observations down to IDs present in the trace before calling (after also fixing the population count).
  3. Ensure any ID-rewriting middleware is disabled so IDs pass through unchanged.
Defensive patterns

Strategy: validation

Validate before calling

func joinableToTrace(records []ObservationRecord, trace []TraceRecord) error {
	byID := map[string]bool{}
	for _, t := range trace {
		byID[t.RequestID] = true
	}
	for _, r := range records {
		if !byID[r.RequestID] {
			return fmt.Errorf("observation %q absent from trace", r.RequestID)
		}
	}
	return nil
}

Prevention

When it happens

Trigger: EvaluateObservedAgainstTrace where records contain a RequestID absent from every trace entry — e.g. observations from a different (longer or newer) run than the trace.

Common situations: Observations appended after the trace was regenerated; mixed epochs in one directory; request IDs altered by a proxy between replay and observation capture.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/054872c196baee56. Report an issue: GitHub.