microsoft/playwright · error · ValidationError

${path}: dispatcher with guid ${arg._guid} has type ${arg._t

Error message

${path}: dispatcher with guid ${arg._guid} has type ${arg._type}, expected ${names.toString()}

What it means

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.

Source

Thrown at packages/playwright-core/src/server/dispatchers/dispatcher.ts:259

  }

  private _tChannelImplFromWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext): any {
    if (arg && typeof arg === 'object' && typeof arg.guid === 'string') {
      const guid = arg.guid;
      const dispatcher = this._dispatcherByGuid.get(guid);
      if (!dispatcher)
        throw new ValidationError(`${path}: no object with guid ${guid}`);
      if (names !== '*' && !names.includes(dispatcher._type))
        throw new ValidationError(`${path}: object with guid ${guid} has type ${dispatcher._type}, expected ${names.toString()}`);
      return dispatcher;
    }
    throw new ValidationError(`${path}: expected guid for ${names.toString()}`);
  }

  private _tChannelImplToWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext): any {
    if (arg instanceof Dispatcher)  {
      if (names !== '*' && !names.includes(arg._type))
        throw new ValidationError(`${path}: dispatcher with guid ${arg._guid} has type ${arg._type}, expected ${names.toString()}`);
      return { guid: arg._guid };
    }
    throw new ValidationError(`${path}: expected dispatcher ${names.toString()}`);
  }

  existingDispatcher<DispatcherType>(object: any): DispatcherType | undefined {
    return this._dispatcherByObject.get(object) as DispatcherType | undefined;
  }

  registerDispatcher(dispatcher: DispatcherScope) {
    assert(!this._dispatcherByGuid.has(dispatcher._guid));
    this._dispatcherByGuid.set(dispatcher._guid, dispatcher);
    this._dispatcherByObject.set(dispatcher._object, dispatcher);
    let list = this._dispatchersByBucket.get(dispatcher._gcBucket);
    if (!list) {
      list = new Set();
      this._dispatchersByBucket.set(dispatcher._gcBucket, list);
    }

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. If you are modifying Playwright: ensure the dispatcher type matches the channel definition and regenerate channels/types (npm run build / watch).
  2. Run npm run flint to catch protocol/channel drift and check generate_channels.
  3. For end users hitting this on stock Playwright, report it — it points to a Playwright bug, not your test.
Defensive patterns

Strategy: try-catch

Try / catch

// Internal Playwright error; surface clearly during development.
try {
  await connection.dispatch(...);
} catch (e) {
  if (/has type .* expected/.test(e.message)) {
    throw new Error('Playwright internal dispatcher type mismatch — regenerate channels and rebuild');
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Developing/modifying Playwright itself: editing dispatcher return types, changing protocol.yml, or stale generated channels.d.ts; rarely seen by end users.

Related errors


AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12). Data as JSON: /api/errors/3461b79a057c8796. Report an issue: GitHub.