{"record":{"id":"16255b26c58f0857","repo":"grafana/k6","slug":"archive-size-w","errorCode":null,"errorMessage":"archive_size: %w","messagePattern":"archive_size: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloudapi/provisioning/api.go","lineNumber":218,"sourceCode":"\tif err := json.Unmarshal(req.Options, &opts); err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshalling options for SDK: %w\", err)\n\t}\n\n\tmaxVUs, err := toInt32(req.MaxVUs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"max_vus: %w\", err)\n\t}\n\ttotalDuration, err := toInt32(req.TotalDuration)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"total_duration: %w\", err)\n\t}\n\n\tsdkReq := k6cloud.NewStartLocalExecutionTestRequest(opts, maxVUs, totalDuration)\n\n\tif req.ArchiveSize > 0 {\n\t\tv, err := toInt32(req.ArchiveSize)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"archive_size: %w\", err)\n\t\t}\n\t\tsdkReq.SetArchiveSize(v)\n\t} else {\n\t\tsdkReq.SetArchiveSizeNil()\n\t}\n\n\tres, hr, err := c.apiClient.ProvisioningAPI.\n\t\tStartLocalExecutionTest(c.authCtx(ctx), loadTestID).\n\t\tK6IdempotencyKey(hex.EncodeToString(key[:])).\n\t\tStartLocalExecutionTestRequest(sdkReq).\n\t\tExecute()\n\tdefer closeResponse(hr, &err)\n\n\tif hr != nil {\n\t\tif respErr := CheckResponse(hr); respErr != nil {\n\t\t\treturn nil, respErr\n\t\t}\n\t}","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cloudapi/provisioning/api.go#L200-L236","documentation":"Client.StartLocalExecution (internal/cloudapi/provisioning/api.go:218) converts req.ArchiveSize (bytes) to int32 when a non-zero archive is being uploaded. Archives larger than 2 GiB (2147483647 bytes) exceed the int32 field in the cloud API schema and are rejected client-side before any request is sent.","triggerScenarios":"params.Archive serialises to more than 2 GiB: huge bundled scripts, embedded binary fixtures, or accidentally included build artifacts/node_modules in the archive.","commonSituations":"Web projects bundling large assets into the k6 archive; directories with generated files picked up by the archive; --include-patterns pulling in unintended content.","solutions":["Shrink the archive: remove large embedded files, prune unnecessary includes, avoid bundling node_modules/build output","Host very large fixtures externally and fetch them at runtime instead of archiving them","Run with --no-archive-upload if the archive is not needed by the cloud side (ArchiveSize is then 0 and sent as JSON null)","Check archive size on disk before running to catch regressions early"],"exampleFix":"# before\nk6 cloud run script.js  # archive silently exceeds 2 GiB\n\n# after\nk6 cloud run --no-archive-upload script.js\n# or prune large files:\nprintf 'node_modules/**\\ndist/**' > .k6ignore && k6 cloud run script.js","handlingStrategy":"validation","validationCode":"const maxArchiveBytes = 2 << 30 // practical int32 ceiling\nif size := int64(buf.Len()); size > maxArchiveBytes {\n\treturn fmt.Errorf(\"archive is %d bytes; limit is %d — prune contents or use --no-archive-upload\", size, maxArchiveBytes)\n}","typeGuard":"func fitsInt32(v int64) bool { return v >= math.MinInt32 && v <= math.MaxInt32 }","tryCatchPattern":"if err := client.ProvisionLocalExecution(ctx, params); err != nil {\n\tif strings.Contains(err.Error(), \"archive_size:\") {\n\t\t// reduce archive contents or skip archive upload\n\t}\n\treturn err\n}","preventionTips":["Check archive size on disk before running","Keep large fixtures out of the archive; fetch at runtime","Wire --no-archive-upload into CI configs that don't need cloud-side archives"],"tags":["archive","int32","overflow","size-limit","upload"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}