You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: 1.62.0 regresion - "Future exception was never retrieved" error when locator method raises a TypeError #42232
test passes and no errors about futures are logged
Actual behavior
==================================================================================================== 1 passed in 3.00s =====================================================================================================
Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
Additional context
i'm not sure how often this would come up in a real test, but there seem to be other cases where this happens but this is the only one i've been able to minify.
this specific example came from a unit test where we test our own customized reporting on playwright errors
Environment
- Operating System: windows 11, ubuntu (whatever version the playwright docker image uses)
- CPU: x86_64
- Browser: chromium
- Python Version: 3.14.6
Thanks for the report. I can reproduce on earlier versions as well, the trigger seems to be that object() can't be json-serialized. Let me see how we can surface that error better.
hmm, i can reproduce this on 1.61.0 as well actually. though something definitely has changed because my CI only started failing since updating to 1.62.0, and disabling this test seemed to fix it. so i have no idea why this only started happening now
Interesting, I believe we're looking at a different error then. Future exception was never retrieved is the equivalent of Node.js unhandled rejection and it's a very generic error that can have all kinds of underlying causes. If you could share more about the shape of the 1.61-1.62 regression, even if you can't reduce it to a minimal repro, that'd be much appreciated. I wanna make sure we didn't break something gravely here.
Task was destroyed but it is pending!
task: <Task cancelling name='Task-3' coro=<Connection.run.<locals>.init() running at C:\Users\user\project\.venv\Lib\site-packages\playwright\_impl\_connection.py:344> wait_for=<Future finished result=None>>
Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
it looks like those specific cases are working now, however since updating to python 3.14.7 more of our tests have started failing due to "Future exception was never retrieved" errors, even on the latest version from main (154f67ced51ada646b0fcf8574897d96c9712aa3)
i'll investigate further and try to get a minimal repro, but it's difficult because it seems to only happen intermittently and only in CI but not locally :(
Activity
Skn0tt commentedon Aug 3, 2026
Thanks for the report. I can reproduce on earlier versions as well, the trigger seems to be that
object()can't be json-serialized. Let me see how we can surface that error better.DetachHead commentedon Aug 3, 2026
hmm, i can reproduce this on 1.61.0 as well actually. though something definitely has changed because my CI only started failing since updating to 1.62.0, and disabling this test seemed to fix it. so i have no idea why this only started happening now
Skn0tt commentedon Aug 3, 2026
Interesting, I believe we're looking at a different error then.
Future exception was never retrievedis the equivalent of Node.jsunhandled rejectionand it's a very generic error that can have all kinds of underlying causes. If you could share more about the shape of the 1.61-1.62 regression, even if you can't reduce it to a minimal repro, that'd be much appreciated. I wanna make sure we didn't break something gravely here.DetachHead commentedon Aug 3, 2026
here's a much simpler repro that only happens on 1.62.0:
Rafiot commentedon Aug 4, 2026
Yep, was about to open an issue, that's my repro:
I "fixed" it by making the code async, and it works just fine.
Skn0tt commentedon Aug 12, 2026
Fixes landed and will be released in 1.63.
DetachHead commentedon Aug 13, 2026
it looks like those specific cases are working now, however since updating to python 3.14.7 more of our tests have started failing due to "Future exception was never retrieved" errors, even on the latest version from main (154f67ced51ada646b0fcf8574897d96c9712aa3)
i'll investigate further and try to get a minimal repro, but it's difficult because it seems to only happen intermittently and only in CI but not locally :(
pavelfeldman commentedon Aug 14, 2026
I'll close this issue as addressed by microsoft/playwright-python#3167. DetachHead send your repro our way and we'll fix it.