microsoft/playwright · error · Error

Cannot find parent object ${parentGuid} to create ${guid}

Error message

Cannot find parent object ${parentGuid} to create ${guid}

What it means

Thrown by _createRemoteObject when a __create__ message names a parent guid (parentGuid) that is not in _objects. New remote objects must be created under an existing parent; if the parent was disposed/collected or was never created on the client, the create fails. A race or out-of-order creation in the protocol stream.

Source

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

    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);
  }
}

function formatCallLog(log: string[] | undefined): string {
  if (!log || !log.some(l => !!l))
    return '';
  return `
Call log:
${colors.dim(log.join('\n'))}
`;
}

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Avoid disposing parents (context/page) while creation-heavy operations are in flight.
  2. Ensure client/server versions match.
  3. Verify any custom transport preserves message ordering.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await context.newPage();
} catch (e) {
  if (/Cannot find parent object/.test(String(e?.message))) {
    // Parent (context/browser) disposed mid-create — recreate and retry.
    await recreateContext();
    return context.newPage();
  }
  throw e;
}

Prevention

When it happens

Trigger: Server announces a new object under a parent the client has already disposed, or sends creates in an order where the child arrives before its parent. Occurs during rapid teardown/creation interleaving, or under a custom transport that reorders frames.

Common situations: Closing a context/page while the server is still creating child objects (workers, requests, frames); a buggy proxy reordering messages; version skew.

Related errors


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