JuliusBrussee/caveman · error

cacheengine: no stable prefix

Error message

cacheengine: no stable prefix

What it means

StartEpoch walked the request segments and found zero leading segments that are both Stable and Cacheable, so there is no frozen prefix to open an epoch with. StartEpoch explicitly requires stable content; use Plan if no stable prefix exists.

Solutions

  1. Mark the leading segments Stable and Cacheable before starting an epoch
  2. Call Plan instead of StartEpoch when the request may have no stable prefix
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at cacheengine/engine.go:239

}

// StartEpoch explicitly replaces frozen prefix state for one scope/profile epoch.
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),

View on GitHub (pinned to 766dce6b13)