Skip to content

fix(runner): return error when -fpt filter fails to initialize#2496

Closed
singhvishalkr wants to merge 1 commit into
projectdiscovery:devfrom
singhvishalkr:fix/fpt-error-filter
Closed

fix(runner): return error when -fpt filter fails to initialize#2496
singhvishalkr wants to merge 1 commit into
projectdiscovery:devfrom
singhvishalkr:fix/fpt-error-filter

Conversation

@singhvishalkr
Copy link
Copy Markdown

Summary

  • When users specify -fpt\ (filter-page-type) flag, the dit classifier must be successfully initialized
  • Previously, if the dit model was missing, httpx would only log a warning and silently fail to apply the filter
  • This caused unexpected behavior where error pages would not be filtered as expected

Changes

  • Return a descriptive error when the classifier cannot be initialized for -fpt\ usage
  • Include guidance for users to run \dit data download\ to install the required model

Proof

Before (silent failure):
\
httpx -u jsdk.baidu.com -fpt error
https://jsdk.baidu.com # Error page NOT filtered
\\

After (clear error):
\
httpx -u jsdk.baidu.com -fpt error
FATAL: could not initialize page classifier for -fpt filter: dit: model.json not found (run 'dit data download' to install the model)
\\

Checklist

  • PR created against the correct branch (main)
  • Code follows project conventions
  • Fix is minimal and focused

/claim #2495

When users specify -fpt (filter-page-type) flag, the dit classifier must be successfully initialized. Previously, if the dit model was missing, httpx would only log a warning and silently fail to apply the filter, causing unexpected behavior where error pages would not be filtered as expected.

This change returns a descriptive error when the classifier cannot be initialized for -fpt usage, guiding users to run 'dit data download' to install the required model.

Fixes projectdiscovery#2495

Co-authored-by: Cursor <cursoragent@cursor.com>
@auto-assign auto-assign Bot requested a review from Mzack9999 May 16, 2026 11:31
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 89639688-f76b-42ec-aae9-4d75b241b40a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Mzack9999 Mzack9999 changed the base branch from main to dev May 16, 2026 21:43
@Mzack9999
Copy link
Copy Markdown
Member

Thanks for the attempt, but this doesn't actually fix #2495.

The reported bug is that -fpt error no longer filters error pages out of the box (it worked in v1.8.1 via -fep with zero setup). This PR only converts the silent dit.New() failure into a fatal error and points users at dit data download — a CLI that isn't documented anywhere in this repo. After this change, httpx -u ... -fpt error still doesn't filter anything on a clean install; it just refuses to run, which is a UX regression for existing users with working -fpt invocations in scripts/CI.

The real fix needs to live in the dit bootstrap path — embed the model in the package, ship it with httpx releases, or auto-fetch it into ~/.dit/ on first use (similar to how nuclei pulls templates). Closing this in favor of a proper fix for #2495.

@Mzack9999 Mzack9999 closed this May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants