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.TemplateStore.Load() now returns error instead of nothingpanic("dialers with executionId ... not found") and panic("could not create wait group") replaced with fmt.Errorf() error returnsdialers variable (was only used for the nil check)internal/runner/runner.gointernal/runner/lazy.gointernal/server/nuclei_sdk.golib/sdk.golib/multi.gocmd/integration-test/library.gopkg/protocols/common/automaticscan/util.goWhen 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
...
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.
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.
dev)Fixes #6674
/claim #6674
Bug Fixes
Tests
Tereda_Developer
@teredasites
ProjectDiscovery
@projectdiscovery
Madhavan Deepak
@Madhavan-Deepak