crawl4ai icon indicating copy to clipboard operation
crawl4ai copied to clipboard

[Bug]: TargetClosedError: BrowserType.launch: Target page, context or browser has been closed

Open LLazzar opened this issue 1 year ago • 1 comments

crawl4ai version

0.5.0.post8

Expected Behavior

Crawl without issues second time

Current Behavior

The second time I crawl using

import asyncio
from crawl4ai import *

async def main(url:str):
    async with AsyncWebCrawler() as crawler:
        result = await crawler.arun(
            url=url,
        )
        print(result.markdown)

I got TargetClosedError: BrowserType.launch: Target page, context or browser has been closed , until yesterday it was working superfine, is somebody having this?

Is this reproducible?

Yes

Inputs Causing the Bug


Steps to Reproduce


Code snippets


OS

Linux

Python version

3.10

Browser

No response

Browser version

No response

Error logs & Screenshots (if applicable)

No response

LLazzar avatar Apr 01 '25 10:04 LLazzar

I am also seeing the same error. It only works on the first URL provided.

JohayerChowdury avatar Apr 01 '25 18:04 JohayerChowdury

@LLazzar @JohayerChowdury Yes. This issue was already reported in #842 . It's already root caused and patched. Will be released shortly. Closing this issue as duplicate, so that progress can be tracked in a single issue on #842.

aravindkarnam avatar Apr 02 '25 06:04 aravindkarnam

same error happened today. Crawl4ai worked for the first mother link. and it didn't work in the children links. Nothing in the result.

Jessi11111 avatar Apr 04 '25 20:04 Jessi11111

I don't think the bug was patched yet @Jessi11111

Reference this monkey patch https://github.com/unclecode/crawl4ai/issues/842#issuecomment-2778772791

JohayerChowdury avatar Apr 05 '25 00:04 JohayerChowdury

the same issue with crawl4ai docker version

6p5ra avatar Apr 06 '25 05:04 6p5ra

Same issue as of today (using docker deployment)

dr1ss avatar Apr 09 '25 11:04 dr1ss