grafana/k6 · error

load test not found

Error message

load test not found

What it means

errTestNotExists is returned by the v6 client's findTestByName when an exact-name filtered test lookup returns zero results. It is reached through UploadTest and CreateOrFindLoadTest after a 409 conflict indicated a test with that name already exists — so the subsequent failure to find that same test signals a race or name-encoding mismatch rather than a plain missing test.

Solutions

  1. Simply retry the k6 cloud run/upload command — the conflict/lookup race usually clears
  2. Simplify the test name (--name / cloud.name option): ASCII letters, digits, dashes, no slashes or special characters
  3. Verify in the Grafana Cloud UI that a test with exactly that name exists in the target project
  4. Make sure only one pipeline (or the UI) owns a given test name to avoid concurrent create/delete races

Example fix

// k6 run invocation: special characters in the name can break the lookup
// before
k6 cloud run --name "checkout: eu/zone 1" script.js

// after
k6 cloud run --name "checkout-eu-zone-1" script.js
Defensive patterns

Strategy: try-catch

Try / catch

// The sentinel is unexported; match on message text in Go callers
_, err := client.UploadTest(ctx, name, projectID, arc)
if err != nil && strings.Contains(err.Error(), "load test not found") {
    // create-vs-lookup race: retry the upload, or recreate under a fresh name
}

Prevention

When it happens

Trigger: UploadTest/createTest gets HTTP 409 (duplicate name) from ProjectsLoadTestsCreate, then the follow-up ProjectsLoadTestsRetrieve with Name(name)&Top(1) filter returns an empty list. Typical causes: the test was renamed or deleted in the Grafana Cloud UI between the two calls; the test name contains characters that get URL-encoded differently; another team member/CI job concurrently recreated tests.

Common situations: Teams where the same cloud test name is managed by both the UI and CI; scripts using names with slashes, spaces, or unicode; concurrent k6 cloud run invocations for the same project and name; tokens whose permissions changed mid-flight.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at internal/cloudapi/v6/errors.go:13

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))

View on GitHub (pinned to 01ffac6f24)