grafana/k6 · error

unknown WebSocket's option

Error message

unknown WebSocket's option %s

What it means

Returned by buildParams when the WebSocket options object contains a key that is none of headers, tags, jar or compression. The params parser is strict — unknown keys are rejected rather than ignored — so leftover or misspelled options (e.g. 'header' instead of 'headers') abort connection setup with the offending key name in the message.

Solutions

  1. Remove unrecognized keys from the params object
  2. Check spelling of supported keys: headers, tags, jar, compression
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/modules/k6/websockets/params.go:82 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/bd84f1041260b3ef. Report an issue: GitHub.

Appendix: source

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

				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)