{"record":{"id":"1bf9cd0da4cc1034","repo":"microsoft/playwright","slug":"path-expected-channel-names-tostring-1bf9cd","errorCode":null,"errorMessage":"${path}: expected channel ${names.toString()}","messagePattern":"(.+?): expected channel (.+?)","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/client/connection.ts","lineNumber":307,"sourceCode":"  }\n\n  close(cause?: string) {\n    if (this._closedError)\n      return;\n    this._closedError = new TargetClosedError(cause);\n    for (const callback of this._callbacks.values())\n      callback.reject(this._closedError);\n    this._callbacks.clear();\n    this.emit('close');\n  }\n\n  private _tChannelImplFromWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext) {\n    if (arg && typeof arg === 'object' && typeof arg.guid === 'string') {\n      const object = this._objects.get(arg.guid)!;\n      if (!object)\n        throw new Error(`Object with guid ${arg.guid} was not bound in the connection`);\n      if (names !== '*' && !names.includes(object._type))\n        throw new ValidationError(`${path}: expected channel ${names.toString()}`);\n      return object._channel;\n    }\n    throw new ValidationError(`${path}: expected channel ${names.toString()}`);\n  }\n\n  private _createRemoteObject(parentGuid: string, type: string, guid: string, initializer: any): any {\n    const parent = this._objects.get(parentGuid);\n    if (!parent)\n      throw new Error(`Cannot find parent object ${parentGuid} to create ${guid}`);\n    const validator = findValidator(type, '', 'Initializer');\n    initializer = validator(initializer, '', this._validatorFromWireContext());\n    const factory = this._objectFactories.get(type);\n    if (!factory)\n      throw new Error('Missing type ' + type);\n    return factory(parent, type, guid, initializer);\n  }\n}\n","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/client/connection.ts#L289-L325","documentation":"Thrown by _tChannelImplFromWire when the referenced object exists in _objects but its _type is not in the allowed names list (and names !== '*'). The server sent an object handle where a specific channel type was expected, but the handle's actual type differs — a protocol contract violation on the wire.","triggerScenarios":"A method/event parameter validated as e.g. 'Page' or 'Frame' carries a guid whose object is a different type (Browser, Request, etc.). Indicates a server bug, version skew, or a custom server emitting the wrong object kind for a field.","commonSituations":"Client/server version mismatch where a field's expected type changed; unofficial server returning mismatched object kinds; a malformed response from a patched server.","solutions":["Match client and server Playwright versions.","If running a patched server, verify it returns the correct object type for each channel-typed field per protocol.yml.","Reproduce with DEBUG=pw:channel and confirm the offending field and the actual type received."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await page.someApiCallReturningObject();\n} catch (e) {\n  if (/expected channel/.test(String(e?.message))) {\n    // Server returned the wrong object type — almost always a version mismatch.\n    throw new Error('Client/server Playwright version mismatch: ' + e.message);\n  }\n  throw e;\n}","preventionTips":["Lock client and server to the same Playwright release.","Don't run patched servers that change channel field types.","Add a version-handshake check on startup."],"tags":["protocol","validation","type-mismatch","internal"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}