crawl4ai icon indicating copy to clipboard operation
crawl4ai copied to clipboard

[Bug]: crwl -b fail

Open lisuwei opened this issue 7 months ago • 2 comments

crawl4ai version

0.6.1

Expected Behavior

Crawl4AI CLI work using -b parameter

Current Behavior

Image

Image

Is this reproducible?

Yes

Inputs Causing the Bug


Steps to Reproduce


Code snippets


OS

windows

Python version

Python 3.12.6

Browser

No response

Browser version

No response

Error logs & Screenshots (if applicable)

No response

lisuwei avatar May 09 '25 01:05 lisuwei

Root cause

Looking at the code, there are two options both using -b as their shorthand:

@click.option("--browser", "-b", ...)
@click.option("--bypass-cache", "-b", is_flag=True, ...)

When Click sees -b, it can't tell which one you mean. Since --bypass-cache is a flag that doesn't take a value, it treats everything after -b as an unexpected argument.

Suggestions

Change one of the shorthands to something else:

# Either this:
@click.option("--bypass-cache", "-bc", is_flag=True, ...)

# Or this:
@click.option("--browser", "-br", ...)

aravindkarnam avatar May 12 '25 11:05 aravindkarnam

@lisuwei As you can see the error is result of a conflicting shorthand "-b" between "--browser" and "--bypass-cache". We'll fix it in the next release. In the meantime use the full form.

crwl https://example.com --browser "headless=true,viewport_width=1280,user_agent_mode=random"

aravindkarnam avatar May 12 '25 11:05 aravindkarnam