{"record":{"id":"a4d3aa549235d823","repo":"grafana/k6","slug":"invalid-websocket-endpoint-q-w","errorCode":null,"errorMessage":"invalid WebSocket endpoint %q: %w","messagePattern":"invalid WebSocket endpoint %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/chromium/browser_type.go","lineNumber":160,"sourceCode":"\t\t\tTimeout: browserOpts.Timeout,\n\t\t}\n\t\treturn nil, fmt.Errorf(\"%w\", err)\n\t}\n\n\treturn bp, nil\n}\n\n// validateWSEndpoint returns an error if wsEndpoint is not a usable CDP\n// WebSocket URL, catching common mistakes (an empty value, a non-ws scheme,\n// a missing host, etc.) before we attempt to connect.\nfunc validateWSEndpoint(wsEndpoint string) error {\n\tif strings.TrimSpace(wsEndpoint) == \"\" {\n\t\treturn errors.New(\"WebSocket endpoint cannot be empty\")\n\t}\n\n\tu, err := url.Parse(wsEndpoint)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid WebSocket endpoint %q: %w\", wsEndpoint, err)\n\t}\n\n\tif u.Scheme != \"ws\" && u.Scheme != \"wss\" {\n\t\treturn fmt.Errorf(\n\t\t\t\"invalid WebSocket endpoint %q: scheme must be ws or wss, got %q\", wsEndpoint, u.Scheme,\n\t\t)\n\t}\n\n\tif u.Hostname() == \"\" {\n\t\treturn fmt.Errorf(\"invalid WebSocket endpoint %q: host is missing\", wsEndpoint)\n\t}\n\n\treturn nil\n}\n\n// Connect attaches k6 browser to an existing browser instance.\n//\n// vuCtx is the context coming from the VU itself. The k6 vu/iteration controls","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/chromium/browser_type.go#L142-L178","documentation":"Error \"invalid WebSocket endpoint %q: %w\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/chromium/browser_type.go:160 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}