grafana/k6 · error
uploading: %w
Error message
uploading: %w
What it means
Raised in RemoteFilePersister.Persist when checkStatusCode rejects the upload response: the presigned-URL upload endpoint returned an HTTP status outside 2xx after the body was successfully drained. The wrapped error names the status code and reason text. This means the remote storage service refused the upload — expired presigned URL, signature mismatch, oversized payload, or server-side failure.
Source
Thrown at internal/js/modules/k6/browser/storage/file_persister.go:117
}
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)
if err != nil {
return PresignedURLResponse{}, fmt.Errorf("building request body: %w", err)
}
req, err := http.NewRequestWithContext(
ctx,
http.MethodPost,
r.presignedURLRequestURL,
bytes.NewReader(b),View on GitHub (pinned to 01ffac6f24)
Solutions
- Retry the whole persist to obtain a fresh presigned URL (they expire)
- Verify authentication headers and cloud credentials are valid
- Check artifact size limits imposed by the storage service
- Examine the status text in the wrapped error (403=expired/signed URL issue, 413=too large, 5xx=server side)
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/storage/file_persister.go:117 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/cc76b0ac48f4fe92.
Report an issue: GitHub.