{"record":{"id":"e11f83fe69362c04","repo":"JuliusBrussee/caveman","slug":"cacheengine-nil-engine-e11f83","errorCode":null,"errorMessage":"cacheengine: nil engine","messagePattern":"cacheengine: nil engine","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/native.go","lineNumber":20,"sourceCode":"\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"io\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice\"\n)\n\n// Optimize applies provider-native cache metadata or returns copied original\n// bytes on every unsupported or unsafe path. It makes no network call.\nfunc (e *Engine) Optimize(ctx context.Context, request NativeRequest) (NativeResult, error) {\n\tif e == nil || e.guard == nil || e.prefixSafety == nil || e.resolveProfile == nil {\n\t\treturn NativeResult{}, errors.New(\"cacheengine: nil engine\")\n\t}\n\tif e.configErr != nil {\n\t\treturn NativeResult{}, e.configErr\n\t}\n\tif ctx == nil {\n\t\treturn NativeResult{}, errors.New(\"cacheengine: nil context\")\n\t}\n\tif err := ctx.Err(); err != nil {\n\t\treturn NativeResult{}, err\n\t}\n\tif len(request.Body) > e.maxRequestBytes {\n\t\treturn NativeResult{}, errors.New(\"cacheengine: request exceeds configured byte limit\")\n\t}\n\toriginal := append([]byte(nil), request.Body...)\n\tunsupported := Profile{ID: \"unsupported\", Mode: ModeUnsupported, Attribution: AttributionNone}\n\tresult := NativeResult{\n\t\tBody:     original,\n\t\tDecision: DecisionPassThrough,","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/native.go#L2-L38","documentation":"Optimize was invoked on a nil or incompletely constructed Engine (nil receiver, or missing guard/prefix-safety/profile-resolver internals). Engines built by New are always complete; this guard catches zero-value or manually assembled structs.","triggerScenarios":"Thrown at cacheengine/native.go:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Construct the engine via cacheengine.New/NewChecked before calling Optimize","Check the engine pointer at call sites that may receive an optional engine"],"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-14T05:17:10.506Z"}