microsoft/playwright · error · Error

Object with guid ${arg.guid} was not bound in the connection

Error message

Object with guid ${arg.guid} was not bound in the connection

What it means

Thrown in _tChannelImplFromWire when a channel-typed value arriving from the server references a guid (arg.guid) that is not in _objects. The validator expected an object reference, the wire gave one, but the client has no local proxy for it. This is a wire-reference integrity failure — the server named an object the client never created or has already lost.

Source

Thrown at packages/playwright-core/src/client/connection.ts:305

    const validator = findValidator(object._type, method, 'Event');
    (object._channel as any).emit(method, validator(params, '', this._validatorFromWireContext()));
  }

  close(cause?: string) {
    if (this._closedError)
      return;
    this._closedError = new TargetClosedError(cause);
    for (const callback of this._callbacks.values())
      callback.reject(this._closedError);
    this._callbacks.clear();
    this.emit('close');
  }

  private _tChannelImplFromWire(names: '*' | string[], arg: any, path: string, context: ValidatorContext) {
    if (arg && typeof arg === 'object' && typeof arg.guid === 'string') {
      const object = this._objects.get(arg.guid)!;
      if (!object)
        throw new Error(`Object with guid ${arg.guid} was not bound in the connection`);
      if (names !== '*' && !names.includes(object._type))
        throw new ValidationError(`${path}: expected channel ${names.toString()}`);
      return object._channel;
    }
    throw new ValidationError(`${path}: expected channel ${names.toString()}`);
  }

  private _createRemoteObject(parentGuid: string, type: string, guid: string, initializer: any): any {
    const parent = this._objects.get(parentGuid);
    if (!parent)
      throw new Error(`Cannot find parent object ${parentGuid} to create ${guid}`);
    const validator = findValidator(type, '', 'Initializer');
    initializer = validator(initializer, '', this._validatorFromWireContext());
    const factory = this._objectFactories.get(type);
    if (!factory)
      throw new Error('Missing type ' + type);
    return factory(parent, type, guid, initializer);
  }

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Align client and server Playwright versions exactly.
  2. If using a custom server, ensure every guid it references was first announced via __create__.
  3. Avoid disposing objects whose handles may still be returned by in-flight calls.
  4. Reproduce with DEBUG=pw:channel and inspect the missing guid's create/dispose order.
Defensive patterns

Strategy: validation

Validate before calling

// Caller cannot fix wire references directly, but can prevent the version skew that causes them.
const { version } = require('playwright-core/package.json');
const serverVersion = await fetchVersionFromServer(); // your own endpoint
if (version !== serverVersion) throw new Error(`playwright client ${version} != server ${serverVersion}`);

Try / catch

try {
  await someCall();
} catch (e) {
  if (/was not bound in the connection/.test(String(e?.message))) {
    await reconnectWithMatchedVersion();
  } else throw e;
}

Prevention

When it happens

Trigger: A response/event parameter validated as a TChannel names a guid that was either never sent via __create__ on the client, or was already disposed before this message. Can follow version skew (server emits objects the client doesn't model) or a create-after-dispose race.

Common situations: Client and server Playwright versions mismatched; a custom/patched server emits references to objects the client lacks; rapid dispose racing with method results that return object handles.

Related errors


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