Summary

This PR replaces panic() calls with proper error returns in the template loader when dialers are not initialized or wait group creation fails.

Problem

The template loader in pkg/catalog/loader/loader.go currently panics when protocolstate.GetDialersWithId() returns nil or when wait group creation fails. This is too harsh for a public API that may be exercised in non-scanning flows.

Solution

Replace panic with proper error propagation:

  • LoadTemplatesWithTags now returns ([]*templates.Template, error)
  • LoadTemplates now returns ([]*templates.Template, error)
  • Load() now returns error

Changes

Updated all callers to handle the new error returns:

  • 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

Testing

  • Code compiles successfully
  • All existing tests should pass (error handling is additive)

Checklist

  • Code compiles correctly
  • All callers updated to handle errors
  • Breaking change documented in function signatures

/claim #6674

Fixes #6674

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling and reporting for template loading operations throughout the system. Error conditions are now properly detected and reported instead of being silently ignored, ensuring more reliable diagnostics and preventing incomplete template loads from going unnoticed.

Claim

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

Contributors

SI

Simplereally

@Simplereally

100%

Sponsors

PR

ProjectDiscovery

@projectdiscovery

$100
MA

Madhavan Deepak

@Madhavan-Deepak

$100