{"record":{"id":"5a456cc82a4770bd","repo":"grafana/k6","slug":"server-returned-d-s","errorCode":null,"errorMessage":"server returned %d (%s)","messagePattern":"server returned (.+?) \\((.+?)\\)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/storage/file_persister.go","lineNumber":248,"sourceCode":"\t}\n\n\treq, err := http.NewRequestWithContext(\n\t\tctx,\n\t\tpsu.Method,\n\t\tpsu.PresignedURL,\n\t\t&form,\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating new request: %w\", err)\n\t}\n\treq.Header.Set(\"Content-Type\", fw.FormDataContentType())\n\n\treturn req, nil\n}\n\nfunc checkStatusCode(resp *http.Response) error {\n\tif resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {\n\t\treturn fmt.Errorf(\"server returned %d (%s)\", resp.StatusCode, strings.ToLower(http.StatusText(resp.StatusCode)))\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":230,"sourceCodeEnd":253,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/storage/file_persister.go#L230-L253","documentation":"Returned by checkStatusCode (a generic sentinel-style guard, not a wrapper — no %w) when an HTTP response's status falls outside 200–299; '%d' is the status code and '%s' its lowercased reason text. It guards both the presigned-URL request and the upload request in RemoteFilePersister. It fires when the remote service rejects the call: expired/invalid presigned URL (403), auth failure (401), payload too large (413), or server errors (5xx).","triggerScenarios":"Thrown at internal/js/modules/k6/browser/storage/file_persister.go:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the whole persist to obtain a fresh presigned URL (they expire quickly)","Verify cloud credentials and auth headers are valid","Reduce artifact size if hitting 413 limits","Use the status code/reason in the message to pinpoint auth vs size vs server issues"],"exampleFix":null,"handlingStrategy":"retry","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-14T05:17:10.506Z"}