{"record":{"id":"a45a9215f5cf54fc","repo":"microsoft/playwright","slug":"cannot-find-parent-object-parentguid-to-create","errorCode":null,"errorMessage":"Cannot find parent object ${parentGuid} to create ${guid}","messagePattern":"Cannot find parent object (.+?) to create (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/client/connection.ts","lineNumber":316,"sourceCode":"    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\nfunction formatCallLog(log: string[] | undefined): string {\n  if (!log || !log.some(l => !!l))\n    return '';\n  return `\nCall log:\n${colors.dim(log.join('\\n'))}\n`;\n}\n","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/client/connection.ts#L298-L334","documentation":"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.","triggerScenarios":"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.","commonSituations":"Closing a context/page while the server is still creating child objects (workers, requests, frames); a buggy proxy reordering messages; version skew.","solutions":["Avoid disposing parents (context/page) while creation-heavy operations are in flight.","Ensure client/server versions match.","Verify any custom transport preserves message ordering."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await context.newPage();\n} catch (e) {\n  if (/Cannot find parent object/.test(String(e?.message))) {\n    // Parent (context/browser) disposed mid-create — recreate and retry.\n    await recreateContext();\n    return context.newPage();\n  }\n  throw e;\n}","preventionTips":["Avoid disposing parents while creation calls are in flight.","Preserve message ordering in any custom transport.","Match client/server versions."],"tags":["protocol","race-condition","lifecycle","internal"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}