projectdiscovery/nuclei · error

could not compile regex %s: %s

Error message

could not compile regex %s: %s

What it means

Error "could not compile regex %s: %s" thrown in projectdiscovery/nuclei.

Source

Thrown at internal/server/scope/scope.go:23

	"fmt"
	"net/url"
	"regexp"
)

// Manager manages scope for crawling process
type Manager struct {
	inScope    []*regexp.Regexp
	outOfScope []*regexp.Regexp
	noScope    bool
}

// NewManager returns a new scope manager for crawling
func NewManager(inScope, outOfScope []string) (*Manager, error) {
	manager := &Manager{}

	for _, regex := range inScope {
		if compiled, err := regexp.Compile(regex); err != nil {
			return nil, fmt.Errorf("could not compile regex %s: %s", regex, err)
		} else {
			manager.inScope = append(manager.inScope, compiled)
		}
	}
	for _, regex := range outOfScope {
		if compiled, err := regexp.Compile(regex); err != nil {
			return nil, fmt.Errorf("could not compile regex %s: %s", regex, err)
		} else {
			manager.outOfScope = append(manager.outOfScope, compiled)
		}
	}
	if len(manager.inScope) == 0 && len(manager.outOfScope) == 0 {
		manager.noScope = true
	}
	return manager, nil
}

// Validate returns true if the URL matches scope rules

View on GitHub (pinned to 265b3a3dec)

When it happens

Trigger: Thrown at internal/server/scope/scope.go:23 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15). Data as JSON: /api/errors/217af263c0f69108. Report an issue: GitHub.