projectdiscovery/nuclei · error

failed to execute template: %w

Error message

failed to execute template: %w

What it means

Error "failed to execute template: %w" thrown in projectdiscovery/nuclei.

Source

Thrown at pkg/reporting/trackers/jira/jira.go:94

		"title":     cases.Title(language.English).String,
		"contains":  strings.Contains,
		"hasPrefix": strings.HasPrefix,
		"hasSuffix": strings.HasSuffix,
		"trim":      strings.Trim,
		"trimSpace": strings.TrimSpace,
		"replace":   strings.ReplaceAll,
		"split":     strings.Split,
		"join":      strings.Join,
	}

	tmpl, err := template.New("field").Funcs(funcMap).Parse(templateStr)
	if err != nil {
		return templateStr, fmt.Errorf("failed to parse template: %w", err)
	}

	var buf bytes.Buffer
	if err := tmpl.Execute(&buf, ctx); err != nil {
		return templateStr, fmt.Errorf("failed to execute template: %w", err)
	}

	return buf.String(), nil
}

// evaluateCustomFieldValue evaluates a custom field value, supporting both new template syntax and legacy $variable syntax
func (i *Integration) evaluateCustomFieldValue(value string, templateCtx *TemplateContext, event *output.ResultEvent) (interface{}, error) {
	// Try template evaluation first (supports {{...}} syntax)
	if strings.Contains(value, "{{") {
		return evaluateTemplate(value, templateCtx)
	}

	// Handle legacy $variable syntax for backward compatibility
	if strings.HasPrefix(value, "$") {
		variableName := strings.TrimPrefix(value, "$")
		switch variableName {
		case "CVSSMetrics":
			if event.Info.Classification != nil {

View on GitHub (pinned to 265b3a3dec)

When it happens

Trigger: Thrown at pkg/reporting/trackers/jira/jira.go:94 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15). Data as JSON: /api/errors/f582990bf1e996c0. Report an issue: GitHub.