Skip to content

fix(fingerprints): fallback gracefully when browserforge raises ValueError on unsupported Chrome versions - #397

Closed
shdwkl wants to merge 1 commit into
D4Vinci:mainfrom
shdwkl:fix/browserforge-header-generator-fallback
Closed

fix(fingerprints): fallback gracefully when browserforge raises ValueError on unsupported Chrome versions#397
shdwkl wants to merge 1 commit into
D4Vinci:mainfrom
shdwkl:fix/browserforge-header-generator-fallback

Conversation

@shdwkl

@shdwkl shdwkl commented Aug 3, 2026

Copy link
Copy Markdown

Description

When chromium_version or chrome_version hardcoded in scrapling/engines/toolbelt/fingerprints.py exceeds the maximum version supported in browserforge's header dataset (apify-fingerprint-datapoints), HeaderGenerator.generate() raises a ValueError:

ValueError: No headers based on this input can be generated. Please relax or change some of the requirements you specified.

Because generate_headers(browser_mode=False) is executed at module import time in scrapling/engines/_browsers/_config_tools.py, this ValueError crashes any application importing scrapling at boot time.

Fix

  • Wrapped HeaderGenerator(...).generate() in a try...except ValueError block in generate_headers().
  • If the exact min_version=ver, max_version=ver constraint is not present in browserforge's dataset, it falls back to unconstrained browser definitions.
  • Ensures generate_headers() always returns valid headers without crashing.

Copilot AI review requested due to automatic review settings August 3, 2026 02:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents scrapling from crashing at import time when browserforge can’t generate headers for a hardcoded (too-new) Chrome/Chromium version by adding a graceful fallback path in the header generation helper.

Changes:

  • Wrap HeaderGenerator(...).generate() in try/except ValueError inside generate_headers().
  • On ValueError, retry header generation with unconstrained browser definitions (no explicit version constraints).
  • Preserve existing behavior differences between “browser mode” vs non-browser mode while ensuring import-time header generation doesn’t fail.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@D4Vinci

D4Vinci commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Nice idea, buddy, but it's not the optimal solution. I will make scrapling access Apify's neural network right away to skip the generation part, so it's faster, and also I want it now to be not limited to desktop devices only.

This whole issue was caused by an issue with apify-fingerprint-datapoints version 0.14.0, but they have now released version 0.15.0, which fixed it. Anyway, I will make sure this doesn't happen again

@D4Vinci D4Vinci closed this Aug 8, 2026
@D4Vinci D4Vinci added the dependency bug A bug occurred due to issues with one or more dependency updates. label Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependency bug A bug occurred due to issues with one or more dependency updates.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants