Proposed Changes

Replace both panic() calls in the template loader’s LoadTemplatesWithTags function with proper error returns, allowing callers to handle missing dialers and wait group failures gracefully instead of crashing.

Changes:

  • LoadTemplatesWithTags and LoadTemplates now return ([]*templates.Template, error) instead of just []*templates.Template
  • Store.Load() now returns error instead of nothing
  • Both panic("dialers with executionId ... not found") and panic("could not create wait group") replaced with fmt.Errorf() error returns
  • Moved the executionId/dialers check before the waitgroup creation to avoid unnecessary allocation on early error
  • Inlined the dialers variable (was only used for the nil check)
  • All 7 callers updated to handle and propagate the new error:
    • internal/runner/runner.go
    • internal/runner/lazy.go
    • internal/server/nuclei_sdk.go
    • lib/sdk.go
    • lib/multi.go
    • cmd/integration-test/library.go
    • pkg/protocols/common/automaticscan/util.go
  • Benchmark tests updated to handle the two-value return and fail fast on errors

Proof

Before

When dialers are not initialized, the application panics with an unrecoverable crash:

panic: dialers with executionId abc123 not found
goroutine 1 [running]:
github.com/projectdiscovery/nuclei/v3/pkg/catalog/loader.(*Store).LoadTemplatesWithTags(...)
pkg/catalog/loader/loader.go:720
...

After

Errors are returned and propagated up the call chain:

error: could not load templates: dialers with executionId abc123 not found

Callers receive the error and can handle it (log, retry, return) instead of crashing.

Compilation verified

go build ./... # passes cleanly

All function signatures maintain backward-compatible behavior: callers already checked for nil/empty template slices, and now additionally check the error return.

Checklist

  • PR created against the correct branch (dev)
  • All callers updated to handle new error return
  • Benchmark tests updated for new signatures
  • No behavioral changes for the normal flow where dialers are properly initialized

Fixes #6674

/claim #6674

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Template loading errors are now properly captured and reported throughout the system. Operations fail early when templates cannot be loaded, preventing execution with incomplete or missing templates.
  • Tests

    • Updated template loading benchmarks to handle error cases explicitly.

Claim

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

Contributors

TE

Tereda_Developer

@teredasites

100%

Sponsors

PR

ProjectDiscovery

@projectdiscovery

$100
MA

Madhavan Deepak

@Madhavan-Deepak

$100