{"record":{"id":"8385ed27a51be4bf","repo":"JuliusBrussee/caveman","slug":"trial-compression-replay-exceeds-d-byte-payload-b","errorCode":null,"errorMessage":"trial compression replay exceeds %d-byte payload budget","messagePattern":"trial compression replay exceeds (.+?)-byte payload budget","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/internal/store/trial_store.go","lineNumber":552,"sourceCode":"\t\tif recovery != nil {\n\t\t\t_ = recovery.Close()\n\t\t}\n\t}()\n\tvar eng *engine.Engine\n\tvar totalBytes int64\n\tvar payloadCount, before, after, transformed int\n\tfor rows.Next() {\n\t\tvar p struct {\n\t\t\traw                       []byte\n\t\t\tbytes                     int64\n\t\t\tprovider, model, endpoint string\n\t\t}\n\t\tif err := rows.Scan(&p.raw, &p.bytes, &p.provider, &p.model, &p.endpoint); err != nil {\n\t\t\treturn TrialMove{}, \"\", err\n\t\t}\n\t\tpayloadCount++\n\t\tif p.bytes < 0 || p.bytes > maxBytes || totalBytes > maxBytes-p.bytes {\n\t\t\treturn TrialMove{}, \"\", fmt.Errorf(\"trial compression replay exceeds %d-byte payload budget\", maxBytes)\n\t\t}\n\t\ttotalBytes += p.bytes\n\t\tadapter := replayAdapter(p.provider)\n\t\tif adapter == nil {\n\t\t\tcontinue\n\t\t}\n\t\tsegments, reassemble, ok := adapter.ExtractCompressible(p.raw, providers.RequestMetadata{\n\t\t\tProvider: p.provider,\n\t\t\tModel:    p.model,\n\t\t\tEndpoint: p.endpoint,\n\t\t})\n\t\tif !ok || len(segments) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif eng == nil {\n\t\t\tif err := os.MkdirAll(filepath.Dir(ccrPath), 0o700); err != nil {\n\t\t\t\treturn TrialMove{}, \"\", err\n\t\t\t}","sourceCodeStart":534,"sourceCodeEnd":570,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/proxy/internal/store/trial_store.go#L534-L570","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Reduce the number/size of captured payloads for the trial or trim the capture set before replay","Increase the payload budget configuration if your workflow legitimately needs bigger replays","Audit capture code so oversized bodies are rejected or chunked at capture time","Verify payload rows in the store for corruption (negative byte sizes)"],"exampleFix":"// before\nplan, err := store.AnalyzeTrial(trialID, hugeCcrPath)\n// after\ninfo, _ := os.Stat(hugeCcrPath)\nif info != nil && info.Size() > maxPayloadBudget {\n\treturn fmt.Errorf(\"ccr capture %d bytes exceeds replay budget; trim captures\", info.Size())\n}\nplan, err := store.AnalyzeTrial(trialID, hugeCcrPath)","handlingStrategy":"validation","validationCode":"var total int64\nfor _, p := range payloads {\n\tif p.bytes < 0 || p.bytes > maxBytes || total > maxBytes-p.bytes {\n\t\treturn fmt.Errorf(\"payload set exceeds %d-byte replay budget\", maxBytes)\n\t}\n\ttotal += p.bytes\n}","typeGuard":null,"tryCatchPattern":"if err := store.AnalyzeTrial(...); err != nil {\n\tif strings.Contains(err.Error(), \"payload budget\") {\n\t\t// reduce capture set or raise budget\n\t}\n}","preventionTips":["Cap capture size at record time (reject or truncate oversized bodies)","Monitor capture set size before triggering replay","Prune old/irrelevant payload rows per trial"],"tags":["limits","replay","store"],"backgroundTag":"payload-too-large","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}