{"record":{"id":"fbded7e1bb8caa6d","repo":"microsoft/playwright","slug":"cannot-find-object-to-method-guid","errorCode":null,"errorMessage":"Cannot find object to \"${method}\": ${guid}","messagePattern":"Cannot find object to \"(.+?)\": (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/client/connection.ts","lineNumber":272,"sourceCode":"          parsedError.details = detailsValidator(errorDetails ?? {}, '', this._validatorFromWireContext());\n        callback.reject(parsedError);\n      } else {\n        const validator = findValidator(callback.type, callback.method, 'Result');\n        callback.resolve(validator(result, '', this._validatorFromWireContext()));\n      }\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","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/client/connection.ts#L254-L290","documentation":"Thrown in dispatch() when an event (not __create__/__adopt__/__dispose__) arrives for a guid not present in _objects. The owning ChannelOwner was already disposed/collected on the client, but the server emitted an event for it before learning of the disposal. This is a benign race in the disposal/event ordering surfaced as a hard throw.","triggerScenarios":"An object is disposed (explicit close or GC) and the server simultaneously fires an event (e.g. close, requestfinished, console) — the event arrives at the client after the object left _objects. Common with rapidly closed pages/contexts/frames under heavy event traffic.","commonSituations":"Closing a page while network events are still streaming; context.dispose() racing with response events; aggressive GC coupled with a chatty page; flaky timing in fast-running suites.","solutions":["Avoid tearing down pages/contexts while high-volume events are in flight; await outstanding operations first.","If reproducible, capture DEBUG=pw:channel to confirm the event-vs-dispose ordering.","Upgrade client/server to the same version — later Playwright builds add guards for this race.","Treat as a known transient if it only appears in teardown paths; isolate teardown from active event sources."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await page.waitForResponse(url);\n} catch (e) {\n  if (/Cannot find object to/.test(String(e?.message))) {\n    // Event raced with disposal; safe to ignore during teardown.\n    return;\n  }\n  throw e;\n}","preventionTips":["Drain in-flight event sources before calling page.close()/context.close().","Detach your own listeners before teardown.","Upgrade client/server in lockstep where these races are hardened."],"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"}