JuliusBrussee/caveman · error

trial compression replay exceeds

Error message

trial compression replay exceeds %d-byte payload budget

What it means

replayCompressionMove reads captured payloads for the trial and enforces a total/individual byte budget (maxBytes). If any single payload is negative or over budget, or the accumulated total would exceed the budget, it aborts replay with this error. This is a resource-safety guard so local replay cannot balloon memory or unbounded rows.

Solutions

  1. Reduce the number/size of captured payloads for the trial or trim the capture set before replay
  2. Increase the payload budget configuration if your workflow legitimately needs bigger replays
  3. Audit capture code so oversized bodies are rejected or chunked at capture time
  4. Verify payload rows in the store for corruption (negative byte sizes)

Example fix

// before
plan, err := store.AnalyzeTrial(trialID, hugeCcrPath)
// after
info, _ := os.Stat(hugeCcrPath)
if info != nil && info.Size() > maxPayloadBudget {
	return fmt.Errorf("ccr capture %d bytes exceeds replay budget; trim captures", info.Size())
}
plan, err := store.AnalyzeTrial(trialID, hugeCcrPath)
Defensive patterns

Strategy: validation

Validate before calling

var total int64
for _, p := range payloads {
	if p.bytes < 0 || p.bytes > maxBytes || total > maxBytes-p.bytes {
		return fmt.Errorf("payload set exceeds %d-byte replay budget", maxBytes)
	}
	total += p.bytes
}

Try / catch

if err := store.AnalyzeTrial(...); err != nil {
	if strings.Contains(err.Error(), "payload budget") {
		// reduce capture set or raise budget
	}
}

Prevention

When it happens

Trigger: Replaying a trial whose captured payloads table contains rows summing above the budget, or a single corrupted/oversized payload row (p.bytes < 0 or > maxBytes, or integer overflow of totalBytes).

Common situations: Capturing very large provider request bodies during a long trial; corrupted capture rows with negative sizes; replaying many payloads at once; accidental capture of file uploads.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/8385ed27a51be4bf. Report an issue: GitHub.

Appendix: source

Thrown at proxy/internal/store/trial_store.go:552

		if recovery != nil {
			_ = recovery.Close()
		}
	}()
	var eng *engine.Engine
	var totalBytes int64
	var payloadCount, before, after, transformed int
	for rows.Next() {
		var p struct {
			raw                       []byte
			bytes                     int64
			provider, model, endpoint string
		}
		if err := rows.Scan(&p.raw, &p.bytes, &p.provider, &p.model, &p.endpoint); err != nil {
			return TrialMove{}, "", err
		}
		payloadCount++
		if p.bytes < 0 || p.bytes > maxBytes || totalBytes > maxBytes-p.bytes {
			return TrialMove{}, "", fmt.Errorf("trial compression replay exceeds %d-byte payload budget", maxBytes)
		}
		totalBytes += p.bytes
		adapter := replayAdapter(p.provider)
		if adapter == nil {
			continue
		}
		segments, reassemble, ok := adapter.ExtractCompressible(p.raw, providers.RequestMetadata{
			Provider: p.provider,
			Model:    p.model,
			Endpoint: p.endpoint,
		})
		if !ok || len(segments) == 0 {
			continue
		}
		if eng == nil {
			if err := os.MkdirAll(filepath.Dir(ccrPath), 0o700); err != nil {
				return TrialMove{}, "", err
			}

View on GitHub (pinned to 3ee70a1026)