{"record":{"id":"b4c63a10398fa2a5","repo":"JuliusBrussee/caveman","slug":"baseline-grading-w","errorCode":null,"errorMessage":"baseline grading: %w","messagePattern":"baseline grading: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/evals/quality.go","lineNumber":197,"sourceCode":"\tcounter := tokens.Default()\n\treport.BaselineUsage, err = fillUsage(counter, baselinePrompt, baseline, opts.RequireUsage)\n\tif err != nil {\n\t\treturn QualityReport{}, fmt.Errorf(\"baseline usage: %w\", err)\n\t}\n\treport.CompressedUsage, err = fillUsage(counter, compressedPrompt, compressedResp, opts.RequireUsage)\n\tif err != nil {\n\t\treturn QualityReport{}, fmt.Errorf(\"compressed usage: %w\", err)\n\t}\n\n\tbaseSubject := Subject{Input: input, Output: baseline.Output, ContentType: contentType, PassedThrough: true}\n\tcompSubject := Subject{Input: input, Output: compressedResp.Output, Ratio: compressionRatio, ContentType: contentType, PassedThrough: passedThrough}\n\tgrader := opts.Grader\n\tif grader == nil {\n\t\tgrader = LocalGrader{}\n\t}\n\treport.BaselineFailures, err = gradeFailures(ctx, grader, graders, baseSubject)\n\tif err != nil {\n\t\treturn QualityReport{}, fmt.Errorf(\"baseline grading: %w\", err)\n\t}\n\treport.CompressedFailures, err = gradeFailures(ctx, grader, graders, compSubject)\n\tif err != nil {\n\t\treturn QualityReport{}, fmt.Errorf(\"compressed grading: %w\", err)\n\t}\n\treport.BaselinePassed = len(report.BaselineFailures) == 0\n\treport.CompressedPassed = len(report.CompressedFailures) == 0\n\tif report.BaselinePassed && report.CompressedPassed {\n\t\treport.Retention = 1\n\t}\n\treturn report, nil\n}\n\nfunc fillUsage(counter tokens.Counter, prompt []byte, resp ModelResponse, requireRunnerUsage bool) (ModelUsage, error) {\n\tusage := resp.Usage\n\tif usage.InputTokens > 0 && usage.OutputTokens > 0 {\n\t\tusage.Source = \"runner\"\n\t\treturn usage, nil","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/engine/evals/quality.go#L179-L215","documentation":"Wraps gradeFailures for the baseline subject in runQuality: the grader (injected or LocalGrader) errored while evaluating the baseline response, as distinct from producing failures. Grading infrastructure failure aborts the quality report.","triggerScenarios":"Thrown at engine/evals/quality.go:197 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped grader error (LLM grader connectivity, malformed grader config)","Use the default LocalGrader to rule out custom-grader bugs","Fix grader configuration in the fixture's QualityTask"],"exampleFix":null,"handlingStrategy":"try-catch","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"}