Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: CrawlerRunConfig.clone() drops fallback_fetch_function, so deep crawls never use it

未关闭 适合新手
#2,379 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@siva23367 已经在做这个了。

开始于 2026年10月19日。

  • #2385 来自 @Parsiffall1 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

问题出在 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

unclecode/crawl4ai 的其他 Issue

查看 unclecode/crawl4ai 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。