grafana/k6 · error
marshaling request body: %w
Error message
marshaling request body: %w
What it means
Raised in buildPresignedRequestBody when json.Marshal fails on the internal presign request struct (service, operation, files). Because the struct contains only plain strings, a marshal failure is effectively impossible under normal operation — encountering this error signals an internal inconsistency or unsupported string content, not a user-input problem at the file level.
Source
Thrown at internal/js/modules/k6/browser/storage/file_persister.go:179
Operation string `json:"operation"`
Files []struct {
Name string `json:"name"`
} `json:"files"`
}{
Service: "aws_s3",
Operation: "upload_post",
Files: []struct {
Name string `json:"name"`
}{
{
Name: filepath.ToSlash(filepath.Join(basePath, path)),
},
},
}
bb, err := json.Marshal(b)
if err != nil {
return nil, fmt.Errorf("marshaling request body: %w", err)
}
return bb, nil
}
func readPresignedURLResponse(resp *http.Response) (PresignedURLResponse, error) {
var rb PresignedURLResponse
decoder := json.NewDecoder(resp.Body)
err := decoder.Decode(&rb)
if err != nil {
return PresignedURLResponse{}, fmt.Errorf("decoding response body: %w", err)
}
if len(rb.URLs) == 0 {
return PresignedURLResponse{}, errors.New("missing presigned url in response body")
}
View on GitHub (pinned to 01ffac6f24)
Solutions
- Report as a k6 internal bug with the artifact path and configuration that triggered it
- Upgrade to the latest k6 version in case the payload construction changed
- Double-check basePath/path values for unusual content (invalid UTF-8)
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/storage/file_persister.go:179 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/d39e0f7fbf802cd2.
Report an issue: GitHub.