{"record":{"id":"3577497b13bb14d2","repo":"JuliusBrussee/caveman","slug":"cachebench-optimize-request-q-w","errorCode":null,"errorMessage":"cachebench: optimize request %q: %w","messagePattern":"cachebench: optimize request %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay.go","lineNumber":513,"sourceCode":"\ntype preparedReplay struct {\n\trecord    TraceRecord\n\toptimized cacheengine.NativeResult\n}\n\nfunc (runner ReplayRunner) prepare(ctx context.Context, records []TraceRecord) ([]preparedReplay, error) {\n\tprepared := make([]preparedReplay, 0, len(records))\n\tfor _, record := range records {\n\t\tif err := ctx.Err(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: replay preparation interrupted: %w\", err)\n\t\t}\n\t\tnative, err := record.NativeRequest()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\toptimized, err := runner.Engine.Optimize(ctx, native)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cachebench: optimize request %q: %w\", record.RequestID, err)\n\t\t}\n\t\tequivalent := bytes.Equal(native.Body, optimized.Body)\n\t\tif optimized.Applied {\n\t\t\tequivalent = ModelVisibleEquivalent(native.Body, optimized.Body)\n\t\t}\n\t\tif !equivalent {\n\t\t\treturn nil, &ReplayRunError{\n\t\t\t\tRequestID: record.RequestID, FailureCode: \"model_visible_mismatch\",\n\t\t\t\tErr: fmt.Errorf(\"cachebench: request %q failed model-visible equivalence\", record.RequestID),\n\t\t\t}\n\t\t}\n\t\tif optimized.Decision != cacheengine.DecisionApply && optimized.Decision != cacheengine.DecisionObserveOnly && optimized.Reason != cacheengine.ReasonBelowMinimum {\n\t\t\treturn nil, &ReplayRunError{\n\t\t\t\tRequestID: record.RequestID, FailureCode: \"engine_not_cacheable\",\n\t\t\t\tErr: fmt.Errorf(\"cachebench: request %q is not cacheable: %s\", record.RequestID, optimized.Reason),\n\t\t\t}\n\t\t}\n\t\tprepared = append(prepared, preparedReplay{record: record, optimized: optimized})","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/replay.go#L495-L531","documentation":"Engine wrap in ReplayRunner.prepare: runner.Engine.Optimize failed for the named request while computing its optimized form. The wrapped error is the engine failure; the request's native body may be unsupported.","triggerScenarios":"Thrown at cacheengine/cachebench/replay.go:513 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped engine error (often malformed request bodies or unsupported providers)","Fix the cited trace record and re-run preparation"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}