{"record":{"id":"1d9456f4411985e7","repo":"microsoft/playwright","slug":"unknown-new-child-params-guid","errorCode":null,"errorMessage":"Unknown new child: ${params.guid}","messagePattern":"Unknown new child: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/client/connection.ts","lineNumber":277,"sourceCode":"      }\n      return;\n    }\n\n    if (debugLogger.isEnabled('channel'))\n      debugLogger.log('channel', '<EVENT ' + JSON.stringify(message));\n    if (method === '__create__') {\n      this._createRemoteObject(guid, params.type, params.guid, params.initializer);\n      return;\n    }\n\n    const object = this._objects.get(guid);\n    if (!object)\n      throw new Error(`Cannot find object to \"${method}\": ${guid}`);\n\n    if (method === '__adopt__') {\n      const child = this._objects.get(params.guid);\n      if (!child)\n        throw new Error(`Unknown new child: ${params.guid}`);\n      object._adopt(child);\n      return;\n    }\n\n    if (method === '__dispose__') {\n      object._dispose(params.reason);\n      return;\n    }\n\n    const validator = findValidator(object._type, method, 'Event');\n    (object._channel as any).emit(method, validator(params, '', this._validatorFromWireContext()));\n  }\n\n  close(cause?: string) {\n    if (this._closedError)\n      return;\n    this._closedError = new TargetClosedError(cause);\n    for (const callback of this._callbacks.values())","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/client/connection.ts#L259-L295","documentation":"Thrown inside the __adopt__ branch of dispatch() when the child guid (params.guid) is not found in _objects. __adopt__ reparents a remote object under a new parent; if the child was already disposed/collected before the adopt event arrived, the lookup fails. A race between disposal and the server-driven reparenting.","triggerScenarios":"The server re-parents an object (e.g. a frame or request moves scope) while the client has already disposed that child — typically during navigation, popup adoption, or context teardown. The parent exists (the outer guard passed) but the child does not.","commonSituations":"Popup adoption racing with page.close(); iframe detach/reattach during navigation; service-worker or shared-worker scope changes; teardown while the server is restructuring the object tree.","solutions":["Avoid closing/disposing pages or contexts while adoption-sensitive operations are in flight.","Upgrade to matching client/server versions where this race is internally tolerated.","If seen during teardown, sequence your awaits so navigation/adoption completes before close.","Capture DEBUG=pw:channel to confirm the adopt-after-dispose ordering if reproducible."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await context.waitForEvent('page'); // adoption path\n} catch (e) {\n  if (/Unknown new child/.test(String(e?.message))) return; // child disposed mid-adopt\n  throw e;\n}","preventionTips":["Don't close popups/workers while their adoption events may still be in flight.","Sequence navigation and teardown so reparenting completes first.","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"}