{"record":{"id":"3461b79a057c8796","repo":"microsoft/playwright","slug":"path-dispatcher-with-guid-arg-guid-has-typ","errorCode":null,"errorMessage":"${path}: dispatcher with guid ${arg._guid} has type ${arg._type}, expected ${names.toString()}","messagePattern":"(.+?): dispatcher with guid (.+?) has type (.+?), expected (.+?)","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/dispatchers/dispatcher.ts","lineNumber":259,"sourceCode":"  }\n\n  private _tChannelImplFromWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext): any {\n    if (arg && typeof arg === 'object' && typeof arg.guid === 'string') {\n      const guid = arg.guid;\n      const dispatcher = this._dispatcherByGuid.get(guid);\n      if (!dispatcher)\n        throw new ValidationError(`${path}: no object with guid ${guid}`);\n      if (names !== '*' && !names.includes(dispatcher._type))\n        throw new ValidationError(`${path}: object with guid ${guid} has type ${dispatcher._type}, expected ${names.toString()}`);\n      return dispatcher;\n    }\n    throw new ValidationError(`${path}: expected guid for ${names.toString()}`);\n  }\n\n  private _tChannelImplToWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext): any {\n    if (arg instanceof Dispatcher)  {\n      if (names !== '*' && !names.includes(arg._type))\n        throw new ValidationError(`${path}: dispatcher with guid ${arg._guid} has type ${arg._type}, expected ${names.toString()}`);\n      return { guid: arg._guid };\n    }\n    throw new ValidationError(`${path}: expected dispatcher ${names.toString()}`);\n  }\n\n  existingDispatcher<DispatcherType>(object: any): DispatcherType | undefined {\n    return this._dispatcherByObject.get(object) as DispatcherType | undefined;\n  }\n\n  registerDispatcher(dispatcher: DispatcherScope) {\n    assert(!this._dispatcherByGuid.has(dispatcher._guid));\n    this._dispatcherByGuid.set(dispatcher._guid, dispatcher);\n    this._dispatcherByObject.set(dispatcher._object, dispatcher);\n    let list = this._dispatchersByBucket.get(dispatcher._gcBucket);\n    if (!list) {\n      list = new Set();\n      this._dispatchersByBucket.set(dispatcher._gcBucket, list);\n    }","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/dispatchers/dispatcher.ts#L241-L277","documentation":"ValidationError raised in _tChannelImplToWire (the outbound serializer) when a Dispatcher being serialized to the client has a _type not in the accepted names for that result field. Unlike the from-wire variants, this is server-side: the server is returning a Dispatcher of the wrong type for a declared channel slot, which should not happen in correct Playwright code and usually indicates an internal bug or a mismatched dispatcher registration.","triggerScenarios":"A server method returns a Dispatcher whose _type does not match the channel type declared in the result validator (e.g. a method declared to return 'Page' returns a 'Frame' dispatcher). Triggered by Playwright source bugs, out-of-tree forks, or generated-channel mismatches after editing protocol.yml without regenerating channels.","commonSituations":"Developing/modifying Playwright itself: editing dispatcher return types, changing protocol.yml, or stale generated channels.d.ts; rarely seen by end users.","solutions":["If you are modifying Playwright: ensure the dispatcher type matches the channel definition and regenerate channels/types (npm run build / watch).","Run npm run flint to catch protocol/channel drift and check generate_channels.","For end users hitting this on stock Playwright, report it — it points to a Playwright bug, not your test."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Internal Playwright error; surface clearly during development.\ntry {\n  await connection.dispatch(...);\n} catch (e) {\n  if (/has type .* expected/.test(e.message)) {\n    throw new Error('Playwright internal dispatcher type mismatch — regenerate channels and rebuild');\n  }\n  throw e;\n}","preventionTips":["When modifying Playwright, keep dispatcher _type values aligned with protocol.yml and regenerate channels/types.","Run npm run flint (which includes generate_channels and check-deps) before committing protocol changes.","Treat this error in stock Playwright as a bug to report, not a test fix."],"tags":["protocol","validation","internal","dispatcher","type-mismatch"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}