grafana/k6 · error
an error occurred communicating with k6 Cloud
Error message
an error occurred communicating with k6 Cloud
What it means
errUnknown is the v6 cloud client's catch-all for the pathological case where the generated OpenAPI client returns neither a response nor an error (res == nil with err == nil after CheckResponse passed). k6 refuses to dereference a nil response and reports this generic communication failure instead of panicking. It can come back from any v6 call: listProjectsPage, listLoadTestsPage, ListLoadZones, ValidateToken, ValidateOptions, createTest, StartTest, FetchTest, etc.
Source
Thrown at internal/cloudapi/v6/errors.go:14
package cloudapi
import (
"errors"
"fmt"
"net/http"
"strings"
k6cloud "github.com/grafana/k6-cloud-openapi-client-go/k6"
)
var (
errTestNotExists = errors.New("load test not found")
errUnknown = errors.New("an error occurred communicating with k6 Cloud")
)
// ResponseError represents an error cause by talking to the API
type ResponseError struct {
Response *http.Response `json:"-"`
APIError k6cloud.ErrorApiModel `json:"error"`
}
func (e ResponseError) Error() string {
err := e.APIError
msg := err.Message
if err.Target.IsSet() {
msg += " (target: '" + *err.Target.Get() + "')"
}
details := make([]string, len(err.Details))
for i, v := range err.Details {View on GitHub (pinned to 01ffac6f24)
Solutions
- Retry the command — transient empty responses usually do not repeat
- Update k6 so the bundled cloud client matches the current API contract
- Verify K6_CLOUD_HOST is unset or points at the official https://api.grafana.com/cloudloadtesting (do not override unless instructed)
- Test the same call from another network to rule out proxy tampering
- If persistent, capture verbose logs (--log-output or K6_LOG_LEVEL=debug) and report to Grafana support
Defensive patterns
Strategy: retry
Prevention
- Leave K6_CLOUD_HOST at its default unless Grafana support instructs otherwise
- Retry cloud commands once on this generic error — nil-response conditions are almost always transient
- If it recurs, capture K6_LOG_LEVEL=debug output and test from a different network to isolate proxy tampering
When it happens
Trigger: The cloud service (or an intermediary) returns a 2xx with an empty or undecodable body, so the SDK yields a nil result without an error; keep-alive connection races or proxies returning truncated responses can produce the same nil-response outcome.
Common situations: Corporate proxies or service meshes rewriting/truncating responses; transient Grafana Cloud incidents where a 200 carries an empty body; pointing K6_CLOUD_HOST at an endpoint that is not the real cloud API and returns bare 200s.
Understand the failure class
Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.
Related errors
- received empty projects page with next link
- received empty load tests page with next link
- stack URL is required to validate token
- load test not found
- Run `k6 cloud login` to authenticate, or check the docs for
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/c0a8c711a39ccbd6.
Report an issue: GitHub.