Summary

Replace panic with proper error return in template loader when dialers are missing, allowing callers to handle the situation gracefully.

Changes

pkg/catalog/loader/loader.go

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

Callers updated

  • internal/runner/lazy.go - Handle error from LoadTemplates
  • internal/runner/runner.go - Handle error from Load
  • 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 - Update to handle two return values

Before/After

Before (panic):

panic: dialers with executionId abc123 not found

After (graceful error):

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

Test Plan

  • go build ./... passes
  • go vet ./... passes
  • go test ./pkg/catalog/loader/... passes
  • Existing tests continue to work

Fixes #6674

/claim #6674

Summary by CodeRabbit

  • Bug Fixes

    • Template-loading failures are now detected, wrapped (e.g., “could not load templates”) and returned instead of being silently ignored.
    • Initialization paths now propagate load errors to callers, preventing proceed-on-failure scenarios.
    • Validation added to ensure exactly one template is selected; clear errors returned when none or multiple are found.
  • Tests

    • Tests and benchmarks updated to accommodate the revised template-loading behavior and error returns.
  • Style

    • Internal string construction updated to use direct formatted writes, preserving output while reducing intermediate allocations.

Claim

Total prize pool $200
Total paid $100
Status Approved
Submitted February 04, 2026
Last updated February 04, 2026

Contributors

GR

Gregorius Bima Kharisma Wicaksana

@bimakw

100%

Sponsors

PR

ProjectDiscovery

@projectdiscovery

$100 paid
MA

Madhavan Deepak

@Madhavan-Deepak

$100 pending