Summary

Replace panic() calls in LoadTemplatesWithTags with proper error returns, propagating errors through LoadTemplates and Load to all callers. This prevents the nuclei process from crashing when dialers are not initialized (e.g. in lazy auth template loading or automatic scan flows).

Changes

pkg/catalog/loader/loader.go

  • LoadTemplatesWithTags signature: []*templates.Template([]*templates.Template, error)
  • LoadTemplates signature: []*templates.Template([]*templates.Template, error)
  • Load signature: voiderror
  • Replace panic("could not create wait group")fmt.Errorf("could not create wait group: %w", errWg)
  • Replace panic("dialers with executionId...")fmt.Errorf("dialers with executionId %s not found", ...)

Callers updated

  • internal/runner/runner.go — Handle error from Load()
  • internal/runner/lazy.go — Handle error from LoadTemplates()
  • internal/server/nuclei_sdk.go — Handle error from Load()
  • lib/multi.go — Handle error from Load()
  • lib/sdk.go — Handle error from Load()
  • cmd/integration-test/library.go — Handle error from Load()
  • pkg/protocols/common/automaticscan/util.go — Handle error from LoadTemplatesWithTags()
  • pkg/catalog/loader/loader_bench_test.go — Handle two return values

Before/After

Before (panic crashes the process):

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

After (error is returned and handled gracefully):

templates, err := store.LoadTemplates(templatesList)
if err != nil {
// "dialers with executionId abc123 not found"
return err
}

Test Plan

  • go build ./... — compiles successfully
  • go vet ./... — no issues
  • go test ./pkg/catalog/loader/... — all tests pass
  • Existing bench tests updated to handle new return signatures

Fixes #6674

/claim #6674

Summary by CodeRabbit

  • Bug Fixes
    • Template loading now properly catches and reports errors with contextual messages instead of silently failing
    • Improved error propagation throughout template operations for enhanced diagnostics and troubleshooting

Claim

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

Contributors

TH

Thomas

@trasnake87

100%

Sponsors

PR

ProjectDiscovery

@projectdiscovery

$100
MA

Madhavan Deepak

@Madhavan-Deepak

$100