grafana/k6 · error · ExitCode
103
103
Error message
test run stopped from REST API
What it means
Deliberate abort error created in the REST API's PATCH /v1/status handler when a client sets status.stopped=true. It calls execution.AbortTestRun and is decorated with exit code ScriptStoppedFromRESTAPI and abort reason AbortedByUser, so the run terminates gracefully as a user-initiated stop.
Solutions
- Treat this exit as expected if the stop was intentional (e.g. k6 cloud or tooling stopped the run)
- Avoid PATCHing status.stopped unless you want the test to end
- Check for exitcodes.ScriptStoppedFromRESTAPI to distinguish it from failures
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at api/v1/status_routes.go:46 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/6e530686c460e682.
Report an issue: GitHub.
Appendix: source
Thrown at api/v1/status_routes.go:46
body, err := io.ReadAll(r.Body)
if err != nil {
apiError(rw, "Couldn't read request", err.Error(), http.StatusBadRequest)
return
}
var statusEnvelop StatusJSONAPI
if err = json.Unmarshal(body, &statusEnvelop); err != nil {
apiError(rw, "Invalid data", err.Error(), http.StatusBadRequest)
return
}
status := statusEnvelop.Status()
if status.Stopped { //nolint:nestif
execution.AbortTestRun(
cs.RunCtx,
errext.WithAbortReasonIfNone(
errext.WithExitCodeIfNone(fmt.Errorf("test run stopped from REST API"), exitcodes.ScriptStoppedFromRESTAPI),
errext.AbortedByUser,
),
)
} else {
if status.Paused.Valid {
if err = cs.Scheduler.SetPaused(status.Paused.Bool); err != nil {
apiError(rw, "Pause error", err.Error(), http.StatusInternalServerError)
return
}
}
if status.VUsMax.Valid || status.VUs.Valid {
apiError(rw, "Execution config error",
"live VU configuration updates are not supported", http.StatusInternalServerError)
return
}
}
View on GitHub (pinned to 01ffac6f24)