{"record":{"id":"07d77cebd48825e8","repo":"grafana/k6","slug":"unexpected-error-while-getting-the-summary-wrapper","errorCode":null,"errorMessage":"unexpected error while getting the summary wrapper: %w","messagePattern":"unexpected error while getting the summary wrapper: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/runner.go","lineNumber":407,"sourceCode":"\t\tr, vu.Runtime, legacy, s, meta,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcallbackResult, err := runUserProvidedHandleSummaryCallback(summaryCtx, vu, handleSummaryData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif deadlineError := r.checkDeadline(summaryCtx, consts.HandleSummaryFn, nil, nil); deadlineError != nil {\n\t\treturn nil, deadlineError\n\t}\n\n\twrapper := strings.Replace(summaryWrapperLambdaCode, \"/*JSLIB_SUMMARY_CODE*/\", summaryCode, 1)\n\thandleSummaryWrapperRaw, err := vu.Runtime.RunString(wrapper)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unexpected error while getting the summary wrapper: %w\", err)\n\t}\n\thandleSummaryWrapper, ok := sobek.AssertFunction(handleSummaryWrapperRaw)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected error did not get a callable summary wrapper\")\n\t}\n\n\twrapperArgs := prepareHandleWrapperArgs(\n\t\tvu, noColor, enableColors, newMachineReadableSummary, callbackResult, handleSummaryData, summaryData,\n\t)\n\trawResult, _, _, err := vu.runFn(summaryCtx, false, handleSummaryWrapper, nil, wrapperArgs...)\n\n\tif deadlineError := r.checkDeadline(summaryCtx, consts.HandleSummaryFn, rawResult, err); deadlineError != nil {\n\t\treturn nil, deadlineError\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unexpected error while generating the summary: %w\", err)\n\t}","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/runner.go#L389-L425","documentation":"An internal error occurred while evaluating the handleSummary wrapper code that k6 builds by splicing the jslib summary implementation into a wrapper lambda. This is not caused by user summary logic itself failing — it fires when the generated wrapper cannot even be compiled/run by the Sobek runtime, indicating an internal k6 bug or corrupted embedded jslib bundle rather than a script mistake.","triggerScenarios":"Thrown at internal/js/runner.go:407 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Upgrade to the latest k6 release; the embedded jslib summary bundle may be fixed","Report the issue to the k6 GitHub repository with the script and k6 version","As a workaround, avoid exporting a custom handleSummary so the default summary path is used"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}