{"record":{"id":"d73c19820f375fe9","repo":"grafana/k6","slug":"received-empty-load-tests-page-with-next-link","errorCode":null,"errorMessage":"received empty load tests page with next link","messagePattern":"received empty load tests page with next link","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloudapi/v6/api.go","lineNumber":131,"sourceCode":"\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, test := range res.Value {\n\t\t\ttests = append(tests, LoadTest{\n\t\t\t\tID:        test.Id,\n\t\t\t\tProjectID: test.ProjectId,\n\t\t\t\tName:      test.Name,\n\t\t\t\tCreated:   test.Created,\n\t\t\t\tUpdated:   test.Updated,\n\t\t\t})\n\t\t}\n\n\t\tif res.NextLink == nil || *res.NextLink == \"\" {\n\t\t\treturn tests, nil\n\t\t}\n\n\t\tif len(res.Value) == 0 {\n\t\t\treturn nil, errors.New(\"received empty load tests page with next link\")\n\t\t}\n\t\tskip += pageSize\n\t}\n}\n\nfunc (c *Client) listLoadTestsPage(\n\tctx context.Context, projectID int64, skip, top int32,\n) (*k6cloud.LoadTestListResponse, error) {\n\tres, hr, err := c.apiClient.LoadTestsAPI.\n\t\tProjectsLoadTestsRetrieve(c.authCtx(ctx), projectID).\n\t\tXStackId(c.stackID).\n\t\tSkip(skip).\n\t\tTop(top).\n\t\tExecute()\n\tdefer closeResponse(hr, &err)\n\n\tif err := CheckResponse(hr, err); err != nil {\n\t\treturn nil, err","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/cloudapi/v6/api.go#L113-L149","documentation":"Thrown by the k6 v6 cloud API client's ListLoadTests when a paginated ProjectsLoadTestsRetrieve response returns zero tests but still carries a non-empty NextLink. The client guards against a broken pagination contract: a next link implies more items, so an empty page means the loop could never make progress; it aborts instead of looping or returning a truncated list. It surfaces through `k6 cloud test list`.","triggerScenarios":"Calling Client.ListLoadTests (the code behind `k6 cloud test list --project-id N`) when the project has more than 1000 load tests (the fixed pageSize) and the API returns an empty Value array with NextLink set; also from response-mangling proxies or an API/client version mismatch.","commonSituations":"Projects that accumulated 1000+ test definitions over time; CI-generated tests with auto-generated names inflating the count; old k6 binaries against an updated backend.","solutions":["Retry the command — transient pagination glitches usually resolve","Update k6 to the latest release to pick up the current cloud API client","Check the project in the Grafana Cloud UI and archive/delete stale tests if it holds 1000+ entries","Verify no proxy alters the response body, then retry outside it","If persistent, collect verbose logs and report a bug to grafana/k6"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Retry `k6 cloud test list` once on this error — it is usually transient","Archive CI-generated throwaway tests so a project stays well under 1000 entries","Pin and periodically bump the k6 version used in CI to keep the API client current"],"tags":["k6","cloud-api","pagination","test-list","grafana-cloud"],"backgroundTag":"pagination-inconsistency","analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}