Proposed Changes

Replace both panic() calls in LoadTemplatesWithTags with proper error returns using fmt.Errorf, and update all callers to handle errors gracefully.

Changes

Core loader (pkg/catalog/loader/loader.go):

  • LoadTemplatesWithTags() now returns ([]*templates.Template, error) instead of panicking
  • LoadTemplates() signature updated to ([]*templates.Template, error)
  • Load() signature updated to return error
  • Both panics replaced: wait group creation failure and missing dialers

Callers updated:

  • internal/runner/runner.gostore.Load() error checked
  • internal/runner/lazy.goLoadTemplates() error propagated; fixed variable shadowing
  • cmd/integration-test/library.gostore.Load() error checked
  • internal/server/nuclei_sdk.gostore.Load() error checked
  • lib/sdk.gostore.Load() error checked
  • lib/multi.gostore.Load() error checked
  • pkg/protocols/common/automaticscan/util.goLoadTemplatesWithTags() error propagated

Tests:

  • pkg/catalog/loader/loader_bench_test.go — updated for two-value returns

Proof

Build and all tests pass:

$ go build ./...
# clean build, no errors
$ go test ./pkg/catalog/loader/...
ok github.com/projectdiscovery/nuclei/v3/pkg/catalog/loader 0.976s
$ go test ./pkg/protocols/common/automaticscan/...
ok github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/automaticscan 0.796s
$ go test ./internal/runner/...
ok github.com/projectdiscovery/nuclei/v3/internal/runner 1.116s
$ go test ./lib/...
ok github.com/projectdiscovery/nuclei/v3/lib 39.180s
ok github.com/projectdiscovery/nuclei/v3/lib/tests 36.628s

Checklist

  • PR created against the correct branch (dev)
  • All checks passed (build clean, all tests pass)
  • Tests updated for new signatures (bench tests)
  • Documentation added (docstring on LoadTemplatesWithTags)

/claim #6674

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced template loading error handling to properly catch and report failures instead of silently ignoring them, ensuring the system fails gracefully when templates cannot be loaded.

Claim

Total prize pool $200
Total paid $0
Status Pending
Submitted February 18, 2026
Last updated February 18, 2026

Contributors

CR

Cristol

@manas-io-ai

100%

Sponsors

PR

ProjectDiscovery

@projectdiscovery

$100
MA

Madhavan Deepak

@Madhavan-Deepak

$100