{"record":{"id":"3b1b7800b7ff691c","repo":"microsoft/playwright","slug":"failed-to-execute-send-on-websocket-still-in","errorCode":null,"errorMessage":"Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.","messagePattern":"Failed to execute 'send' on 'WebSocket': Still in CONNECTING state\\.","errorType":"exception","errorClass":"DOMException","httpStatus":null,"severity":"error","filePath":"packages/injected/src/webSocketMock.ts","lineNumber":216,"sourceCode":"      if (this._onopenListener)\n        this.addEventListener('open', this._onopenListener);\n    }\n\n    get onmessage() {\n      return this._onmessageListener;\n    }\n\n    set onmessage(listener) {\n      if (this._onmessageListener)\n        this.removeEventListener('message', this._onmessageListener as any);\n      this._onmessageListener = listener;\n      if (this._onmessageListener)\n        this.addEventListener('message', this._onmessageListener as any);\n    }\n\n    send(message: WebSocketMessage): void {\n      if (this.readyState === WebSocketMock.CONNECTING)\n        throw new DOMException(`Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.`);\n      if (this.readyState !== WebSocketMock.OPEN)\n        throw new DOMException(`WebSocket is already in CLOSING or CLOSED state.`);\n      if (this._passthrough) {\n        if (this._ws)\n          this._apiSendToServer(message);\n      } else {\n        messageToData(message, data => binding({ type: 'onMessageFromPage', id: this._id, data }));\n      }\n    }\n\n    close(code?: number, reason?: string): void {\n      if (code !== undefined && code !== 1000 && (code < 3000 || code > 4999))\n        throw new DOMException(`Failed to execute 'close' on 'WebSocket': The close code must be either 1000, or between 3000 and 4999. ${code} is neither.`);\n      if (this.readyState === WebSocketMock.OPEN || this.readyState === WebSocketMock.CONNECTING)\n        this.readyState = WebSocketMock.CLOSING;\n      if (this._passthrough)\n        this._apiCloseServer(code, reason, true);\n      else","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/injected/src/webSocketMock.ts#L198-L234","documentation":"Error \"Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.\" thrown in microsoft/playwright.","triggerScenarios":"Thrown at packages/injected/src/webSocketMock.ts:216 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":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}