grafana/k6 · error

unsupported compression algorithm '%s', supported algorithm

Error message

unsupported compression algorithm '%s', supported algorithm is 'deflate'

What it means

Returned by buildParams when the `compression` entry of the WebSocket options, after trimming whitespace, is not exactly 'deflate'. The experimental permessage-deflate support (RFC 7692, no-context-takeover only, via gorilla/websocket) recognizes that single algorithm name; any other string is rejected before the connection is dialed.

Source

Thrown at internal/js/modules/k6/websockets/params.go:77

				return nil, fmt.Errorf("invalid WebSocket tags option: %w", err)
			}
		case "jar":
			jarV := params.Get(k)
			if common.IsNullish(jarV) {
				continue
			}
			if v, ok := jarV.Export().(*httpModule.CookieJar); ok {
				parsed.cookieJar = v.Jar
			}
		case "compression":
			// deflate compression algorithm is supported - as defined in RFC7692
			// compression here relies on the implementation in gorilla/websocket package, usage is
			// experimental and may result in decreased performance. package supports
			// only "no context takeover" scenario

			algoString := strings.TrimSpace(params.Get(k).ToString().String())
			if algoString != "deflate" {
				return nil, fmt.Errorf("unsupported compression algorithm '%s', supported algorithm is 'deflate'", algoString)
			}

			parsed.enableCompression = true
		default:
			return nil, fmt.Errorf("unknown WebSocket's option %s", k)
		}
	}

	return parsed, nil
}

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Use { compression: 'deflate' } to enable compression
  2. Omit the compression option to disable it
  3. Match the casing exactly — 'Deflate' or 'DEFLATE' are not accepted
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/modules/k6/websockets/params.go:77 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/da59a53bef49d6bf. Report an issue: GitHub.