{"record":{"id":"d00262ac1cf05ec6","repo":"microsoft/playwright","slug":"invalid-dialog-type-type","errorCode":null,"errorMessage":"Invalid dialog type: ${type}","messagePattern":"Invalid dialog type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/webkit/webview/wvPage.ts","lineNumber":347,"sourceCode":"    this._setSession(newSession);\n  }\n\n  private _onTargetDestroyed(event: Protocol.Target.targetDestroyedPayload) {\n    const { targetId } = event;\n    if (this._provisionalPage && this._provisionalPage._session.sessionId === targetId) {\n      this._provisionalPage._session.dispose();\n      this._provisionalPage.dispose();\n      this._provisionalPage = null;\n    } else if (this._session && this._session.sessionId === targetId) {\n      this._session.dispose();\n      eventsHelper.removeEventListeners(this._sessionListeners);\n    }\n  }\n\n  private async _onBridgeDialog(body: any): Promise<{ accept: boolean; promptText?: string }> {\n    const type = body?.type;\n    if (type !== 'alert' && type !== 'confirm' && type !== 'prompt')\n      throw new Error(`Invalid dialog type: ${type}`);\n    const message = typeof body?.message === 'string' ? body.message : '';\n    const defaultValue = typeof body?.defaultValue === 'string' ? body.defaultValue : '';\n    return await new Promise<{ accept: boolean; promptText?: string }>(resolve => {\n      this._page.browserContext.dialogManager.dialogDidOpen(new dialog.Dialog(\n          this._page,\n          type,\n          message,\n          async (accept: boolean, promptText?: string) => resolve({ accept, promptText }),\n          defaultValue,\n      ));\n    });\n  }\n\n  didClose() {\n    this._dialogHandler?.dispose();\n    eventsHelper.removeEventListeners(this._sessionListeners);\n    eventsHelper.removeEventListeners(this._eventListeners);\n    if (this._session)","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/webkit/webview/wvPage.ts#L329-L365","documentation":"Error \"Invalid dialog type: ${type}\" thrown in microsoft/playwright.","triggerScenarios":"Thrown at packages/playwright-core/src/server/webkit/webview/wvPage.ts:347 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"}