{"record":{"id":"d39e0f7fbf802cd2","repo":"grafana/k6","slug":"marshaling-request-body-w","errorCode":null,"errorMessage":"marshaling request body: %w","messagePattern":"marshaling request body: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/storage/file_persister.go","lineNumber":179,"sourceCode":"\t\tOperation string `json:\"operation\"`\n\t\tFiles     []struct {\n\t\t\tName string `json:\"name\"`\n\t\t} `json:\"files\"`\n\t}{\n\t\tService:   \"aws_s3\",\n\t\tOperation: \"upload_post\",\n\t\tFiles: []struct {\n\t\t\tName string `json:\"name\"`\n\t\t}{\n\t\t\t{\n\t\t\t\tName: filepath.ToSlash(filepath.Join(basePath, path)),\n\t\t\t},\n\t\t},\n\t}\n\n\tbb, err := json.Marshal(b)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"marshaling request body: %w\", err)\n\t}\n\n\treturn bb, nil\n}\n\nfunc readPresignedURLResponse(resp *http.Response) (PresignedURLResponse, error) {\n\tvar rb PresignedURLResponse\n\n\tdecoder := json.NewDecoder(resp.Body)\n\terr := decoder.Decode(&rb)\n\tif err != nil {\n\t\treturn PresignedURLResponse{}, fmt.Errorf(\"decoding response body: %w\", err)\n\t}\n\n\tif len(rb.URLs) == 0 {\n\t\treturn PresignedURLResponse{}, errors.New(\"missing presigned url in response body\")\n\t}\n","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/storage/file_persister.go#L161-L197","documentation":"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.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/storage/file_persister.go:179 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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)"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}