grafana/k6 · error
archive_size: %w
Error message
archive_size: %w
What it means
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.
Source
Thrown at internal/cloudapi/provisioning/api.go:218
if err := json.Unmarshal(req.Options, &opts); err != nil {
return nil, fmt.Errorf("unmarshalling options for SDK: %w", err)
}
maxVUs, err := toInt32(req.MaxVUs)
if err != nil {
return nil, fmt.Errorf("max_vus: %w", err)
}
totalDuration, err := toInt32(req.TotalDuration)
if err != nil {
return nil, fmt.Errorf("total_duration: %w", err)
}
sdkReq := k6cloud.NewStartLocalExecutionTestRequest(opts, maxVUs, totalDuration)
if req.ArchiveSize > 0 {
v, err := toInt32(req.ArchiveSize)
if err != nil {
return nil, fmt.Errorf("archive_size: %w", err)
}
sdkReq.SetArchiveSize(v)
} else {
sdkReq.SetArchiveSizeNil()
}
res, hr, err := c.apiClient.ProvisioningAPI.
StartLocalExecutionTest(c.authCtx(ctx), loadTestID).
K6IdempotencyKey(hex.EncodeToString(key[:])).
StartLocalExecutionTestRequest(sdkReq).
Execute()
defer closeResponse(hr, &err)
if hr != nil {
if respErr := CheckResponse(hr); respErr != nil {
return nil, respErr
}
}View on GitHub (pinned to 93accf6570)
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
Example fix
# before k6 cloud run script.js # archive silently exceeds 2 GiB # after k6 cloud run --no-archive-upload script.js # or prune large files: printf 'node_modules/**\ndist/**' > .k6ignore && k6 cloud run script.js
Defensive patterns
Strategy: validation
Validate before calling
const maxArchiveBytes = 2 << 30 // practical int32 ceiling
if size := int64(buf.Len()); size > maxArchiveBytes {
return fmt.Errorf("archive is %d bytes; limit is %d — prune contents or use --no-archive-upload", size, maxArchiveBytes)
} Type guard
func fitsInt32(v int64) bool { return v >= math.MinInt32 && v <= math.MaxInt32 } Try / catch
if err := client.ProvisionLocalExecution(ctx, params); err != nil {
if strings.Contains(err.Error(), "archive_size:") {
// reduce archive contents or skip archive upload
}
return err
} Prevention
- 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
When it happens
Trigger: params.Archive serialises to more than 2 GiB: huge bundled scripts, embedded binary fixtures, or accidentally included build artifacts/node_modules in the archive.
Common situations: Web projects bundling large assets into the k6 archive; directories with generated files picked up by the archive; --include-patterns pulling in unintended content.
Related errors
- creating upload request: %w
- uploading archive: %w
- archive upload failed: %d %s
- archive upload failed: %d %s: %s
- max_vus: %w
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/16255b26c58f0857.
Report an issue: GitHub.