JuliusBrussee/caveman · error

cacheengine: volatile content cannot start stable epoch

Error message

cacheengine: volatile content cannot start stable epoch

What it means

The computed stable prefix for the new epoch contains content that cacheguard.DetectVolatile flags (timestamps, randomness, session-specific data). Freezing volatile content into a reused prefix would poison cache hits, so the epoch is refused.

Solutions

  1. Remove or stabilize volatile segments (timestamps, unique IDs, nonces) from the front of the request
  2. Move volatile content after the stable prefix segments
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cacheengine/engine.go:242 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/7fe33858429013e2. Report an issue: GitHub.

Appendix: source

Thrown at cacheengine/engine.go:242

func (e *Engine) StartEpoch(request PlanRequest) (Plan, error) {
	if e == nil || e.guard == nil {
		return Plan{}, errors.New("cacheengine: nil engine")
	}
	if e.configErr != nil {
		return Plan{}, e.configErr
	}
	if err := validatePlanRequest(request); err != nil {
		return Plan{}, err
	}
	prefix, stableSegments, err := stablePrefix(request.Segments, e.maxStablePrefixBytes)
	if err != nil {
		return Plan{}, err
	}
	if len(stableSegments) == 0 {
		return Plan{}, errors.New("cacheengine: no stable prefix")
	}
	if len(cacheguard.DetectVolatile(prefix)) > 0 {
		return Plan{}, errors.New("cacheengine: volatile content cannot start stable epoch")
	}
	profile := normalizedProfile(request.Profile)
	economicsBasis := "modeled_input_rate_units"
	var warnings []string
	if !profile.EconomicsKnown {
		economicsBasis = "unavailable"
		warnings = []string{"cache_economics_unavailable"}
	}
	result, err := e.guard.StartNewEpoch(epochKey(request.Scope, request.Epoch, profile.ID), prefix)
	if err != nil {
		return Plan{}, err
	}
	return Plan{
		Decision:       DecisionNewEpoch,
		Reason:         string(cacheguard.DecisionNewEpoch),
		ProfileID:      profile.ID,
		Mode:           profile.Mode,
		Attribution:    profile.Attribution,

View on GitHub (pinned to 766dce6b13)