{"record":{"id":"5bfa468d719c107e","repo":"JuliusBrussee/caveman","slug":"cacheengine-no-stable-prefix","errorCode":null,"errorMessage":"cacheengine: no stable prefix","messagePattern":"cacheengine: no stable prefix","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/engine.go","lineNumber":239,"sourceCode":"}\n\n// StartEpoch explicitly replaces frozen prefix state for one scope/profile epoch.\nfunc (e *Engine) StartEpoch(request PlanRequest) (Plan, error) {\n\tif e == nil || e.guard == nil {\n\t\treturn Plan{}, errors.New(\"cacheengine: nil engine\")\n\t}\n\tif e.configErr != nil {\n\t\treturn Plan{}, e.configErr\n\t}\n\tif err := validatePlanRequest(request); err != nil {\n\t\treturn Plan{}, err\n\t}\n\tprefix, stableSegments, err := stablePrefix(request.Segments, e.maxStablePrefixBytes)\n\tif err != nil {\n\t\treturn Plan{}, err\n\t}\n\tif len(stableSegments) == 0 {\n\t\treturn Plan{}, errors.New(\"cacheengine: no stable prefix\")\n\t}\n\tif len(cacheguard.DetectVolatile(prefix)) > 0 {\n\t\treturn Plan{}, errors.New(\"cacheengine: volatile content cannot start stable epoch\")\n\t}\n\tprofile := normalizedProfile(request.Profile)\n\teconomicsBasis := \"modeled_input_rate_units\"\n\tvar warnings []string\n\tif !profile.EconomicsKnown {\n\t\teconomicsBasis = \"unavailable\"\n\t\twarnings = []string{\"cache_economics_unavailable\"}\n\t}\n\tresult, err := e.guard.StartNewEpoch(epochKey(request.Scope, request.Epoch, profile.ID), prefix)\n\tif err != nil {\n\t\treturn Plan{}, err\n\t}\n\treturn Plan{\n\t\tDecision:       DecisionNewEpoch,\n\t\tReason:         string(cacheguard.DecisionNewEpoch),","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/engine.go#L221-L257","documentation":"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.","triggerScenarios":"Thrown at cacheengine/engine.go:239 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Mark the leading segments Stable and Cacheable before starting an epoch","Call Plan instead of StartEpoch when the request may have no stable prefix"],"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"}