JuliusBrussee/caveman · error

cache-replay: failed to finalize failure manifest

Error message

cache-replay: failed to finalize failure manifest: %w

What it means

Raised at the end of a failed cache-replay run while writing the failure manifest: after recording status=failed, the manifest finalization (writing failure-manifest.json) itself errored. The run already failed; this error means the evidence artifact for the failure could not be persisted.

Solutions

  1. Check the wrapped error: common causes are a full disk or the output directory being removed mid-run
  2. Re-run with a fresh output directory on writable storage
  3. Inspect any partially written manifest to salvage what evidence exists
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at cacheengine/cmd/cache-replay/main.go:326 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/7e5ec9f07d1a34fa. Report an issue: GitHub.

Appendix: source

Thrown at cacheengine/cmd/cache-replay/main.go:326

		if summaryErr != nil {
			fatalRuntime(summaryErr)
		}
		manifest.ReplaySummary = &summary
		if err := writeJSON(filepath.Join(*outputPath, "replay-summary.json"), summary); err != nil {
			fatalRuntime(err)
		}
	}
	if runErr != nil {
		manifest.Status = "failed"
		var replayFailure *cachebench.ReplayRunError
		if errors.As(runErr, &replayFailure) {
			manifest.FailedRequest, manifest.FailureCode = replayFailure.RequestID, replayFailure.FailureCode
		} else if len(sink.evidence) > 0 {
			last := sink.evidence[len(sink.evidence)-1]
			manifest.FailedRequest, manifest.FailureCode = last.RequestID, last.FailureCode
		}
		if err := writeJSON(filepath.Join(*outputPath, "manifest.json"), manifest); err != nil {
			fatalRuntime(fmt.Errorf("cache-replay: failed to finalize failure manifest: %w", err))
		}
		fatalRuntime(runErr)
	}
	report, err := cachebench.EvaluateObservedAgainstTrace(sink.observations, records, target)
	if err != nil {
		fatalRuntime(err)
	}
	if err := writeJSON(filepath.Join(*outputPath, "report.json"), report); err != nil {
		fatalRuntime(err)
	}
	manifest.Status = report.Status
	if err := writeJSON(filepath.Join(*outputPath, "manifest.json"), manifest); err != nil {
		fatalRuntime(err)
	}
	writeStdout(map[string]any{"manifest": manifest, "report": report.Overall})
	if !report.Overall.GatePassed {
		os.Exit(1)
	}

View on GitHub (pinned to 766dce6b13)