{"record":{"id":"93a6c7d10ed45082","repo":"grafana/k6","slug":"load-test-not-found","errorCode":null,"errorMessage":"load test not found","messagePattern":"load test not found","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloudapi/v6/errors.go","lineNumber":13,"sourceCode":"package cloudapi\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n\n\tk6cloud \"github.com/grafana/k6-cloud-openapi-client-go/k6\"\n)\n\nvar (\n\terrTestNotExists = errors.New(\"load test not found\")\n\terrUnknown       = errors.New(\"an error occurred communicating with k6 Cloud\")\n)\n\n// ResponseError represents an error cause by talking to the API\ntype ResponseError struct {\n\tResponse *http.Response        `json:\"-\"`\n\tAPIError k6cloud.ErrorApiModel `json:\"error\"`\n}\n\nfunc (e ResponseError) Error() string {\n\terr := e.APIError\n\tmsg := err.Message\n\n\tif err.Target.IsSet() {\n\t\tmsg += \" (target: '\" + *err.Target.Get() + \"')\"\n\t}\n\n\tdetails := make([]string, len(err.Details))","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/cloudapi/v6/errors.go#L1-L31","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Simply retry the k6 cloud run/upload command — the conflict/lookup race usually clears","Simplify the test name (--name / cloud.name option): ASCII letters, digits, dashes, no slashes or special characters","Verify in the Grafana Cloud UI that a test with exactly that name exists in the target project","Make sure only one pipeline (or the UI) owns a given test name to avoid concurrent create/delete races"],"exampleFix":"// k6 run invocation: special characters in the name can break the lookup\n// before\nk6 cloud run --name \"checkout: eu/zone 1\" script.js\n\n// after\nk6 cloud run --name \"checkout-eu-zone-1\" script.js","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// The sentinel is unexported; match on message text in Go callers\n_, err := client.UploadTest(ctx, name, projectID, arc)\nif err != nil && strings.Contains(err.Error(), \"load test not found\") {\n    // create-vs-lookup race: retry the upload, or recreate under a fresh name\n}","preventionTips":["Use plain-ASCII test names (no slashes/spaces/unicode) so the name filter round-trips exactly","Give each CI job a distinct, stable test name so pipelines don't create/delete the same name concurrently","Don't rename or delete cloud tests in the UI while a pipeline manages the same name"],"tags":["k6","cloud-api","load-test","not-found","conflict-race"],"backgroundTag":"resource-not-found","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"}