{"record":{"id":"e37cf801dbf09aab","repo":"grafana/k6","slug":"upload-archive-w","errorCode":null,"errorMessage":"upload archive: %w","messagePattern":"upload archive: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloudapi/provisioning/provision.go","lineNumber":93,"sourceCode":"\t\tarchiveBytes = buf.Bytes()\n\t}\n\n\tsleReq := StartLocalExecutionRequest{\n\t\tOptions:       params.Options,\n\t\tMaxVUs:        params.MaxVUs,\n\t\tTotalDuration: params.TotalDuration,\n\t\tArchiveSize:   archiveSize,\n\t}\n\n\tsleResp, err := c.StartLocalExecution(ctx, loadTestID, sleReq)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"start local execution: %w\", err)\n\t}\n\n\tswitch {\n\tcase params.Archive != nil && sleResp.ArchiveUploadURL != nil:\n\t\tif err := c.UploadArchive(ctx, *sleResp.ArchiveUploadURL, archiveBytes); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"upload archive: %w\", err)\n\t\t}\n\tcase params.Archive != nil && sleResp.ArchiveUploadURL == nil:\n\t\t// We had an archive to upload but the API returned no upload URL;\n\t\t// proceed without uploading rather than failing the run.\n\t\tc.logger.Warn(\"archive present but provisioning API returned no upload URL; skipping archive upload\")\n\t}\n\n\tif err := c.WaitForTestRunReady(ctx, sleResp.TestRunID, params.PollInterval); err != nil {\n\t\treturn nil, fmt.Errorf(\"wait for test run ready: %w\", err)\n\t}\n\n\treturn &ProvisionResult{\n\t\tTestRunID:             sleResp.TestRunID,\n\t\tTestRunDetailsPageURL: sleResp.TestRunDetailsPageURL,\n\t\tRuntimeConfig:         sleResp.RuntimeConfig,\n\t}, nil\n}\n","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cloudapi/provisioning/provision.go#L75-L111","documentation":"Client.ProvisionLocalExecution (internal/cloudapi/provisioning/provision.go:93) wraps Client.UploadArchive failing to PUT the pre-serialised archive bytes to the presigned S3 URL. The presigned URL carries auth in query parameters; failures are either transport-level (wrapped as 'uploading archive') or non-2xx from S3 — most often 403 (expired or mangled presigned URL) or 400 (signature/content mismatch).","triggerScenarios":"Upload of a very large archive exceeding the presigned URL's validity window; a proxy stripping or re-encoding query parameters; clock skew invalidating the signature; connection timeouts on slow links; any non-2xx S3 status.","commonSituations":"Corporate proxies rewriting URLs; huge archives on constrained uplinks; host clock drift; retries after long provisioning delays reusing a stale URL.","solutions":["Re-provision the run to obtain a fresh presigned URL and retry promptly","Reduce archive size (prune includes, avoid bundling dependencies) to fit the upload window","Ensure no proxy/agent modifies the request URL or query string; bypass it for the S3 host","Verify system clock synchronization (NTP) on the runner","Check the wrapped status text — 403 points at expiry/signature, 5xx at S3 health"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if params.Archive != nil {\n\tconst maxSaneUpload = 1 << 30 // 1 GiB comfort ceiling\n\tif archiveSize > maxSaneUpload {\n\t\treturn fmt.Errorf(\"archive %d bytes too large for reliable upload; prune or use --no-archive-upload\", archiveSize)\n\t}\n}","typeGuard":"func isUploadFailure(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"upload archive\")\n}","tryCatchPattern":"res, err := client.ProvisionLocalExecution(ctx, params)\nif err != nil {\n\tif isUploadFailure(err) {\n\t\t// re-provision to mint a fresh presigned URL, then retry promptly\n\t}\n\treturn err\n}","preventionTips":["Upload immediately after start_local_execution returns — presigned URLs expire","Keep archives small; exclude dependencies and build output","Ensure proxies don't rewrite URLs; sync system clocks via NTP","Retry by re-provisioning, never by reusing a possibly-expired URL"],"tags":["archive","upload","s3","presigned-url","network"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}