microsoft/playwright · error · Error
Unknown new child: ${params.guid}
Error message
Unknown new child: ${params.guid} What it means
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.
Source
Thrown at packages/playwright-core/src/client/connection.ts:277
}
return;
}
if (debugLogger.isEnabled('channel'))
debugLogger.log('channel', '<EVENT ' + JSON.stringify(message));
if (method === '__create__') {
this._createRemoteObject(guid, params.type, params.guid, params.initializer);
return;
}
const object = this._objects.get(guid);
if (!object)
throw new Error(`Cannot find object to "${method}": ${guid}`);
if (method === '__adopt__') {
const child = this._objects.get(params.guid);
if (!child)
throw new Error(`Unknown new child: ${params.guid}`);
object._adopt(child);
return;
}
if (method === '__dispose__') {
object._dispose(params.reason);
return;
}
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())View on GitHub (pinned to c8fc3bf8d3)
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.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await context.waitForEvent('page'); // adoption path
} catch (e) {
if (/Unknown new child/.test(String(e?.message))) return; // child disposed mid-adopt
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Cannot find object to "${method}": ${guid}
- Cannot find parent object ${parentGuid} to create ${guid}
- Cannot find command to respond: ${id}
- Object with guid ${arg.guid} was not bound in the connection
- ${path}: expected channel ${names.toString()}
AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12).
Data as JSON: /api/errors/1d9456f4411985e7.
Report an issue: GitHub.