crawl4ai icon indicating copy to clipboard operation
crawl4ai copied to clipboard

docs(cli): clarify `--output json` behavior when no extraction strategy is provided

Open ege-arhan opened this issue 1 month ago • 1 comments

Problem

Running crawl4ai CLI with -o json without specifying an extraction strategy (--extractor / JsonCssExtractionStrategy) yields raw unparsed HTML or empty JSON payloads depending on the depth level.

Suggested Improvement

Add a note in CLI docs or command help indicating that structured -o json export expects an extraction schema/strategy to be configured, otherwise defaulting to markdown/HTML output with a helpful warning.

ege-arhan avatar Oct 04 '26 18:10 ege-arhan

Thanks for reporting this @ege-arhan

There are 3 PRs targeting this issue, One targets fixes the help test, one fixes the documentation and one fixes the code:

  • #2362 (code fix): -o json without an extraction strategy (-j or -e) now stops before the crawl starts, with a clear error:
    Error: -o json needs an extraction strategy (-j or -e). Use -o all for the full crawl result.
    
    It also removes the duplicate JSON print, fixes the broken -o json example in crwl examples, and removes the json choice from the profile crawl menu.
  • #2335 (help text): clarifies the --output help in the CLI.
  • #2348 (docs): updates the CLI docs and replaces the misleading -o json examples.

All three apply cleanly and can be merged together once the review on the 2 PRs have been addressed.

SohamKukreti avatar Oct 12 '26 13:10 SohamKukreti