[Bug]: CrawlerRunConfig.clone() drops fallback_fetch_function, so deep crawls never use it
维护者通常 1 天内回复
评估
调研方向
问题出在 CrawlerRunConfig.clone(),它根据 to_dict() 重建配置,而 to_dict() 省略了 fallback_fetch_function。请先阅读 CrawlerRunConfig 上的 clone 和 to_dict 方法,并确认 issue 中的代码片段在克隆后返回 None。当克隆保留了可调用对象,使得抓取失败的 deep crawl 页面与 arun() 以相同方式进入回退逻辑时,即完成;请添加一个测试,验证该字段在 clone(stream=True) 之后仍然保留。
由索引模型根据 Issue 内容生成。
描述
crawl4ai version
0.9.5 (same on 0.9.0)
Expected Behavior
CrawlerRunConfig.clone() returns a copy with every field, fallback_fetch_function included. BFS, DFS and BestFirst deep crawls clone the run config for every batch (config.clone(deep_crawl_strategy=None, stream=...)), so a configured fallback should also apply to deep-crawled pages.
Current Behavior
clone() rebuilds the config from to_dict(), and to_dict() leaves fallback_fetch_function out, so the clone has fallback_fetch_function=None. In a deep crawl, a page whose fetch raises (or is blocked) never reaches the fallback, while the same page fetched with arun() / arun_many() does.
Is this reproducible?
Yes
Code snippets
from crawl4ai import CrawlerRunConfig
async def fallback(url: str) -> str:
return "<html>...</html>"
config = CrawlerRunConfig(fallback_fetch_function=fallback)
print(config.fallback_fetch_function) # <function fallback ...>
print(config.clone(stream=True).fallback_fetch_function) # None
Suggested fix
Carry callables over in clone(), for example by copying fallback_fetch_function (and any other non-serializable field) from self onto the clone unless it is passed in kwargs. A subclass of CrawlerRunConfig whose clone() copies the field over works as a workaround.
- 主要语言
- Python
- 星标
- 85.9k
- 派生
- 8.9k
- 平均合并
- 5 天 7 小时
- 30 天内合并 PR
- 23
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
unclecode/crawl4ai 的其他 Issue
-
[Bug]: Text after an inline <link>, <meta>, <style> or <noscript> is dropped from cleaned_html and markdown可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
unclecode/crawl4ai#2416 · 1 条评论 ·
维护者通常 1 天内回复
-
[Bug]: Since 0.9.1, Linux launches chrome-headless-shell instead of Chromium可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
unclecode/crawl4ai#2382 · 1 条评论 ·
维护者通常 1 天内回复
-
[Bug]: BestFirstCrawlingStrategy fetches a full batch past max_pages可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
unclecode/crawl4ai#2381 · 1 条评论 ·
维护者通常 1 天内回复
-
[Bug]: Docker memory guard reads host RAM when no container limit is set — cgroup v2 "max" defeats get_container_memory_percent可能已有人在做 @Battleplus 于 57 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
unclecode/crawl4ai#2123 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 49/100
维护者通常 1 天内回复
查看 unclecode/crawl4ai 的全部 Issue
相似的 Issue
-
documentation
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
good first issue module-baseline needs triage ux
难度 2/5 1-3 小时 新手友好度 82/100
darnitdevorg/darnit#650 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
nyjc-computing/campus#938 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
nf-osi/nf-metadata-dictionary#1027 ·
维护者通常 1 天内回复
-
bug documentation
难度 1/5 1 小时以内 新手友好度 92/100
qatrackplus/qatrackplus#913 ·
维护者通常 3 天内回复