grafana/k6 · error

received empty projects page with next link

Error message

received empty projects page with next link

What it means

Thrown by the k6 v6 cloud API client's ListProjects when a paginated ProjectsList response returns zero items (res.Value empty) but still carries a non-empty NextLink. The client treats 'next link but empty page' as a broken pagination contract: continuing would either loop forever or silently return an incomplete project list, so it aborts. It surfaces through `k6 cloud project list`.

Solutions

  1. Retry the command once or twice — transient server-side pagination glitches usually clear
  2. Update k6 to the latest version so the bundled cloud API client matches the current contract
  3. Cross-check in the Grafana Cloud UI that the stack actually has projects and note whether it exceeds 1000
  4. Bypass intermediaries (VPN/proxy) or check their response rewriting, then retry
  5. If reproducible, capture `k6 cloud project list` with verbose logging and report it as a k6 or Grafana Cloud bug
Defensive patterns

Strategy: retry

Prevention

When it happens

Trigger: Calling Client.ListProjects (the code behind `k6 cloud project list`) when the stack has more than 1000 projects (the fixed pageSize) and the service returns a page with an empty Value array while NextLink is set; also triggered by a mismatched k6-cloud-openapi-client-go version or a proxy/gateway that mangles the JSON list response.

Common situations: Large organizations with 1000+ projects in one Grafana Cloud stack; corporate proxies rewriting response bodies; transient backend bugs during heavy load; running an old k6 binary against an updated cloud API contract.

Related errors


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/87065c34cc9e7610. Report an issue: GitHub.

Appendix: source

Thrown at internal/cloudapi/v6/api.go:76

		res, err := c.listProjectsPage(ctx, skip, pageSize)
		if err != nil {
			return nil, err
		}

		for _, project := range res.Value {
			projects = append(projects, Project{
				ID:        project.Id,
				Name:      project.Name,
				IsDefault: project.IsDefault,
			})
		}

		if res.NextLink == nil || *res.NextLink == "" {
			return projects, nil
		}

		if len(res.Value) == 0 {
			return nil, errors.New("received empty projects page with next link")
		}
		skip += pageSize
	}
}

func (c *Client) listProjectsPage(
	ctx context.Context, skip, top int32,
) (*k6cloud.ProjectListResponse, error) {
	res, hr, err := c.apiClient.ProjectsAPI.
		ProjectsList(c.authCtx(ctx)).
		XStackId(c.stackID).
		Skip(skip).
		Top(top).
		Execute()
	defer closeResponse(hr, &err)

	if err := CheckResponse(hr, err); err != nil {
		return nil, err

View on GitHub (pinned to 01ffac6f24)