{"record":{"id":"d70f0dda6eea29f1","repo":"microsoft/playwright","slug":"cannot-serialize-result-object-reference-chain-is-d70f0d","errorCode":null,"errorMessage":"Cannot serialize result: object reference chain is too long.","messagePattern":"Cannot serialize result: object reference chain is too long\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/webkit/webview/wvExecutionContext.ts","lineNumber":123,"sourceCode":"    if (!handle._objectId)\n      return;\n    await this._session.send('Runtime.releaseObject', { objectId: handle._objectId });\n  }\n\n  shouldPrependErrorPrefix(): boolean {\n    return false;\n  }\n}\n\nfunction potentiallyUnserializableValue(remoteObject: Protocol.Runtime.RemoteObject): any {\n  const value = remoteObject.value;\n  const isUnserializable = remoteObject.type === 'number' && ['NaN', '-Infinity', 'Infinity', '-0'].includes(remoteObject.description!);\n  return isUnserializable ? js.parseUnserializableValue(remoteObject.description!) : value;\n}\n\nfunction rewriteError(error: Error): Error {\n  if (error.message.includes('Object has too long reference chain'))\n    throw new Error('Cannot serialize result: object reference chain is too long.');\n  if (!js.isJavaScriptErrorInEvaluate(error) && !isSessionClosedError(error))\n    return new Error('Execution context was destroyed, most likely because of a navigation.');\n  return error;\n}\n\nfunction renderPreview(object: Protocol.Runtime.RemoteObject): string | undefined {\n  if (object.type === 'undefined')\n    return 'undefined';\n  if ('value' in object)\n    return String(object.value);\n\n  if (object.description === 'Object' && object.preview) {\n    const tokens = [];\n    for (const { name, value } of object.preview.properties!)\n      tokens.push(`${name}: ${value}`);\n    return `{${tokens.join(', ')}}`;\n  }\n  if (object.subtype === 'array' && object.preview)","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/webkit/webview/wvExecutionContext.ts#L105-L141","documentation":"Error \"Cannot serialize result: object reference chain is too long.\" thrown in microsoft/playwright.","triggerScenarios":"Thrown at packages/playwright-core/src/server/webkit/webview/wvExecutionContext.ts:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}