Skip to content
← Back to activity

Public problem

Semgrep confusing Timeout error on rules with too many matches max_match_per_file

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Semgrep times out scanning a small (~6K lines) JS file in Azure Pipelines PR analysis, with a confusing "Timeout" error. The real cause is a rule producing too many matches, not a slow scan. Increasing the timeout alone does not help.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Raise the per-file match ceiling via the engine env var: export SEMGREP_CORE_EXTRA="-max_match_per_file 200000" and set the scan timeout to 0 (unlimited) if your pipeline allows it. The reporter confirmed this combination got their scan through. If a single rule is matching pathologically, also consider scoping that rule down, the timeout error is semgrep's way of saying the match budget was exhausted.

Source: https://github.com/semgrep/semgrep/issues/2411

Source: https://github.com/semgrep/semgrep/issues/2411