[Bug]: deep crawl configs from dump() are rejected by the server (logger: null) and DFS strategies dump empty
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Start with to_serializable_dict() and the dump() path in CrawlerRunConfig, then look at DFSDeepCrawlStrategy.__init__ in the deep_crawling package, which only forwards *args, **kwargs to BFSDeepCrawlStrategy. Two fixes are needed: skip fields whose value serializes to None, and give DFS named parameters so it dumps max_depth and max_pages. Done when the snippet in the issue prints the expected params, loads with Provenance.UNTRUSTED without error, and a DFS round-trip keeps its parameters.
索引モデルが issue の本文から書いたものです。
説明
crawl4ai version
0.9.5 (also on develop)
Expected Behavior
A deep crawl config produced by CrawlerRunConfig.dump(), as Crawl4aiDockerClient sends it, is accepted by the server when CRAWL4AI_ALLOW_DEEP_CRAWL=true.
Current Behavior
Two problems in to_serializable_dict() stop it:
logger: null. Objects that cannot be deserialized (aLogger, a callable) serialize toNone, but the field is still written. Every deep crawl strategy dumps as{"max_depth": ..., "logger": null}, and the server rejectsloggeron deep crawl strategies from an untrusted request even when it is null:UntrustedConfigError: field 'logger' is not permitted on BFSDeepCrawlStrategy from an untrusted requestDFSDeepCrawlStrategydumps with no parameters. Its__init__only forwards*args, **kwargstoBFSDeepCrawlStrategy, so there are no named parameters to read back:DFSDeepCrawlStrategy(max_depth=3, max_pages=7)dumps as{"type": "DFSDeepCrawlStrategy", "params": {}}, and loading it fails withTypeError: ... missing 1 required positional argument: 'max_depth'. Theloggererror currently hides this one.
Is this reproducible?
Yes
Inputs Causing the Bug
Any CrawlerRunConfig with a deep crawl strategy, loaded with Provenance.UNTRUSTED (the server path).
Steps to Reproduce
Run the snippet below; it reproduces the server's check in-process.
Code snippets
import json
import os
os.environ["CRAWL4AI_ALLOW_DEEP_CRAWL"] = "true"
from crawl4ai import CrawlerRunConfig
from crawl4ai.async_configs import Provenance, to_serializable_dict
from crawl4ai.deep_crawling import BFSDeepCrawlStrategy, DFSDeepCrawlStrategy
cfg = CrawlerRunConfig(deep_crawl_strategy=BFSDeepCrawlStrategy(max_depth=1))
print(cfg.dump()["params"]["deep_crawl_strategy"]["params"]) # {'max_depth': 1, 'logger': None}
CrawlerRunConfig.load(json.loads(json.dumps(cfg.dump())), provenance=Provenance.UNTRUSTED)
# UntrustedConfigError: field 'logger' is not permitted on BFSDeepCrawlStrategy from an untrusted request
print(to_serializable_dict(DFSDeepCrawlStrategy(max_depth=3, max_pages=7)))
# {'type': 'DFSDeepCrawlStrategy', 'params': {}}
OS
Windows 11 (platform-independent)
Python version
3.13
Browser
Not involved
Error logs & Screenshots (if applicable)
See above.
The logger part was found by @SohamKukreti in the review of #2425; the DFS part showed up once it was fixed. I'll open a PR.
- 主要言語
- Python
- スター
- 87.2k
- フォーク
- 9.1k
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 25
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
unclecode/crawl4ai のほかの issue
-
BUG: UserAgentGenerator.generate ignores browser_type and returns a random browser stack対応中かも @HhH666-ux が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Hardened docker-compose (read_only) keeps full Chromium from starting: crashpad needs a writable ~/.config対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン🐞 Bug 📌 Root caused
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
unclecode/crawl4ai#2494 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
⚙ Done ✨ Enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
⚙ Done 🐞 Bug 📌 Root caused
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: PDF images saved with save_images_locally=True come back with an empty src in result.mediaオープン⚙ Done 🐞 Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
unclecode/crawl4ai#2469 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
unclecode/crawl4ai の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
Netcracker/qubership-ai-packages#266 ·
メンテナーはふだん 1 日以内に返信
-
PROCESSED_DATA_FOLDER: strip whitespace and treat empty as unset対応中かも @TorecLuik が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
NL-BioImaging/BIOMERO.importer#63 ·
メンテナーはふだん 1 日以内に返信
-
MLX training-complete chat/merge suggestions omit --backend mlx対応中かも @vaputa が今日担当しました。 オープンneeds-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
MakazhanAlpamys/Soup#2913 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:security effort:S priority:P3 status:needs-triage type:chore
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
randomparity/kdive#3657 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
aws/mcp-proxy-for-aws#476 ·
メンテナーはふだん 1 日以内に返信