JuliusBrussee/caveman · error

cachebench: no observation records

Error message

cachebench: no observation records

What it means

Raised in ReadObservationJSONLWithLimits when the stream contained zero valid observation records (empty input or all lines filtered/errored before append). Evidence-based evaluation requires at least one record, so an empty population is a hard error rather than a trivially-passing report.

Solutions

  1. Confirm the observation JSONL file is non-empty and matches ObservationSchema
  2. Check that request_id values are present and not duplicates (duplicates abort earlier)
  3. Regenerate observations from a replay run before evaluating
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cacheengine/cachebench/observed.go:142 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18). Data as JSON: /api/errors/e92f6408813b2397. Report an issue: GitHub.

Appendix: source

Thrown at cacheengine/cachebench/observed.go:142

		var trailing any
		if err := decoder.Decode(&trailing); err != io.EOF {
			return nil, fmt.Errorf("cachebench: observation line %d: trailing JSON", line)
		}
		if record.Schema != ObservationSchema {
			return nil, fmt.Errorf("cachebench: observation line %d: schema %q", line, record.Schema)
		}
		if strings.TrimSpace(record.RequestID) == "" || seen[record.RequestID] {
			return nil, fmt.Errorf("cachebench: observation line %d: empty or duplicate request_id", line)
		}
		seen[record.RequestID] = true
		record.Usage = append(json.RawMessage(nil), record.Usage...)
		records = append(records, record)
	}
	if err := scanner.Err(); err != nil {
		return nil, fmt.Errorf("cachebench: read observations: %w", err)
	}
	if len(records) == 0 {
		return nil, errors.New("cachebench: no observation records")
	}
	if err := validateObservationRecords(records); err != nil {
		return nil, err
	}
	return records, nil
}

// EvaluateObserved evaluates supplied observations without completeness claim.
func EvaluateObserved(records []ObservationRecord, target Target) (Report, error) {
	if err := validateTarget(target); err != nil {
		return Report{}, err
	}
	if len(records) == 0 {
		return Report{}, errors.New("cachebench: no observation records")
	}
	if err := validateObservationRecords(records); err != nil {
		return Report{}, err
	}

View on GitHub (pinned to 766dce6b13)