Skip to content

[Bug]: BFSDeepCrawlStrategy.can_process_url() rejects valid single-label hostnames (netloc without a dot) #2079

Description

@wiinf

crawl4ai version

0.9.2

Expected Behavior

Single-label/internal hostnames without a dot should be treated as valid
hostnames, at least when the URL has a valid scheme (http/https) and
non-empty netloc. The dot-check appears to be an overly strict heuristic
that isn't part of the documented API/config (no allow_single_label_hosts
or similar flag exists).

Current Behavior

  • Depth 0 (start URL) is fetched successfully.
  • Every discovered link at depth > 0 is logged as:
    Invalid URL: https://name/xyz/xyz, error: Invalid domain
    The configured DomainFilter is never even reached, since the exception
    is raised before filter_chain.apply() is called.

Is this reproducible?

Yes

Inputs Causing the Bug

Steps to Reproduce

1. Start URL: `https://name/xyz/` (a host with no dot in its name,
   reachable e.g. via internal DNS or /etc/hosts).
2. Configure `BFSDeepCrawlStrategy` with
   `filter_chain=FilterChain([DomainFilter(allowed_domains=["iltis3"])])`.
3. Run `crawler.arun()`.

Code snippets

OS

Linux

Python version

3.12.13

Browser

No response

Browser version

No response

Error logs & Screenshots (if applicable)

[INIT].... → Crawl4AI 0.9.2

[FETCH]... ↓ https://name/xyz | ✓ | ⏱: 0.91s

[SCRAPE].. ◆ https://name/xyz | ✓ | ⏱: 0.06s

[EXTRACT]. ■ https://name/xyz | ✓ | ⏱: 0.03s

[COMPLETE] ● https://name/xyz | ✓ | ⏱: 1.01s

Invalid URL: https://name/xyz/neu-im-intranet, error: Invalid domain

Invalid URL: name/xyz/suche, error: Invalid domain

Invalid URL: https://name/xyz

crawler.py

/allgemein/stellen, error: Invalid domain

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 BugSomething isn't working🩺 Needs TriageNeeds attention of maintainers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions