grafana/k6 · error
unexpected error while getting the summary wrapper: %w
Error message
unexpected error while getting the summary wrapper: %w
What it means
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.
Source
Thrown at internal/js/runner.go:407
r, vu.Runtime, legacy, s, meta,
)
if err != nil {
return nil, err
}
callbackResult, err := runUserProvidedHandleSummaryCallback(summaryCtx, vu, handleSummaryData)
if err != nil {
return nil, err
}
if deadlineError := r.checkDeadline(summaryCtx, consts.HandleSummaryFn, nil, nil); deadlineError != nil {
return nil, deadlineError
}
wrapper := strings.Replace(summaryWrapperLambdaCode, "/*JSLIB_SUMMARY_CODE*/", summaryCode, 1)
handleSummaryWrapperRaw, err := vu.Runtime.RunString(wrapper)
if err != nil {
return nil, fmt.Errorf("unexpected error while getting the summary wrapper: %w", err)
}
handleSummaryWrapper, ok := sobek.AssertFunction(handleSummaryWrapperRaw)
if !ok {
return nil, fmt.Errorf("unexpected error did not get a callable summary wrapper")
}
wrapperArgs := prepareHandleWrapperArgs(
vu, noColor, enableColors, newMachineReadableSummary, callbackResult, handleSummaryData, summaryData,
)
rawResult, _, _, err := vu.runFn(summaryCtx, false, handleSummaryWrapper, nil, wrapperArgs...)
if deadlineError := r.checkDeadline(summaryCtx, consts.HandleSummaryFn, rawResult, err); deadlineError != nil {
return nil, deadlineError
}
if err != nil {
return nil, fmt.Errorf("unexpected error while generating the summary: %w", err)
}View on GitHub (pinned to 01ffac6f24)
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
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at internal/js/runner.go:407 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/07d77cebd48825e8.
Report an issue: GitHub.