{"record":{"id":"3341bb6898187a26","repo":"JuliusBrussee/caveman","slug":"cachebench-nil-cache-engine","errorCode":null,"errorMessage":"cachebench: nil cache engine","messagePattern":"cachebench: nil cache engine","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/simulate.go","lineNumber":26,"sourceCode":"\t\"fmt\"\n\t\"math\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/JuliusBrussee/caveman/cacheengine\"\n)\n\ntype cachedPrefix struct {\n\tsegments  []PrefixSegment\n\texpiresAt time.Time\n}\n\ntype cachedPrefixGroup map[string]cachedPrefix\n\n// RunSimulated evaluates deterministic agent workload without provider calls.\nfunc RunSimulated(ctx context.Context, engine *cacheengine.Engine, providers []ProviderConfig, scenario Scenario, target Target) (Report, error) {\n\tif engine == nil {\n\t\treturn Report{}, errors.New(\"cachebench: nil cache engine\")\n\t}\n\tif err := validateTarget(target); err != nil {\n\t\treturn Report{}, err\n\t}\n\tif len(providers) == 0 {\n\t\treturn Report{}, errors.New(\"cachebench: no providers\")\n\t}\n\tif len(providers) > 1024 {\n\t\treturn Report{}, errors.New(\"cachebench: provider population exceeds 1024\")\n\t}\n\treport := baseReport(BasisSimulated, scenario, target, QualityEquivalence)\n\tfor _, provider := range providers {\n\t\ttrace, err := GenerateTrace(provider, scenario)\n\t\tif err != nil {\n\t\t\treturn Report{}, err\n\t\t}\n\t\tproviderReport := evaluateSimulatedTrace(ctx, engine, trace, target)\n\t\treport.Providers = append(report.Providers, providerReport)","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/simulate.go#L8-L44","documentation":"RunSimulated was called with a nil *cacheengine.Engine. The simulation drives the real cache engine to model prefix reuse, so a nil engine (uninitialized pointer or zero-value Engine) is rejected before any scenario runs.","triggerScenarios":"Thrown at cacheengine/cachebench/simulate.go:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Construct the engine with cacheengine.New (or NewChecked) and pass the non-nil result to RunSimulated","Check for a nil engine after construction error handling before calling RunSimulated"],"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"}