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).
pkg/catalog/loader/loader.goLoadTemplatesWithTags signature: []*templates.Template → ([]*templates.Template, error)LoadTemplates signature: []*templates.Template → ([]*templates.Template, error)Load signature: void → errorpanic("could not create wait group") → fmt.Errorf("could not create wait group: %w", errWg)panic("dialers with executionId...") → fmt.Errorf("dialers with executionId %s not found", ...)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 valuesBefore (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
}
go build ./... — compiles successfullygo vet ./... — no issuesgo test ./pkg/catalog/loader/... — all tests passFixes #6674
/claim #6674
Thomas
@trasnake87
ProjectDiscovery
@projectdiscovery
Madhavan Deepak
@Madhavan-Deepak