grafana/k6 · error

performing upload request

Error message

performing upload request: %w

What it means

Raised in RemoteFilePersister.Persist when httpClient.Do fails to execute the already-built multipart upload request against the presigned URL. This is a transport-level failure of the actual artifact upload: connection refused/reset, TLS errors, DNS failure, or the 10-second client timeout expiring before the upload completes.

Solutions

  1. Check network stability and bandwidth to the storage endpoint
  2. Retry the upload; presigned uploads are idempotent when re-requested
  3. Increase reliability by reducing artifact size (e.g. lower screenshot frequency)
  4. Inspect the wrapped transport error for timeout vs connection failure
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/storage/file_persister.go:108 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at internal/js/modules/k6/browser/storage/file_persister.go:108

		},
	}
}

// Persist will upload the contents of data to a remote location.
func (r *RemoteFilePersister) Persist(ctx context.Context, path string, data io.Reader) (err error) {
	psResp, err := r.requestPresignedURL(ctx, path)
	if err != nil {
		return fmt.Errorf("requesting presigned url: %w", err)
	}

	req, err := newFileUploadRequest(ctx, psResp, data)
	if err != nil {
		return fmt.Errorf("creating upload request: %w", err)
	}

	resp, err := r.httpClient.Do(req) //nolint:gosec
	if err != nil {
		return fmt.Errorf("performing upload request: %w", err)
	}
	defer resp.Body.Close() //nolint:errcheck

	if _, err := io.Copy(io.Discard, resp.Body); err != nil {
		return fmt.Errorf("draining upload response body: %w", err)
	}

	if err := checkStatusCode(resp); err != nil {
		return fmt.Errorf("uploading: %w", err)
	}

	return nil
}

// requestPresignedURL will request a new presigned URL from the remote server
// and returns a [PresignedURLResponse] that contains the presigned URL details.
func (r *RemoteFilePersister) requestPresignedURL(ctx context.Context, path string) (PresignedURLResponse, error) {
	b, err := buildPresignedRequestBody(r.basePath, path)

View on GitHub (pinned to 01ffac6f24)