projectdiscovery/nuclei · error
failed to parse template: %w
Error message
failed to parse template: %w
What it means
Error "failed to parse template: %w" thrown in projectdiscovery/nuclei.
Source
Thrown at pkg/reporting/trackers/jira/jira.go:89
// Create template with useful functions for JIRA custom fields
funcMap := template.FuncMap{
"upper": strings.ToUpper,
"lower": strings.ToLower,
"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 compatibilityView on GitHub (pinned to 265b3a3dec)
When it happens
Trigger: Thrown at pkg/reporting/trackers/jira/jira.go:89 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15).
Data as JSON: /api/errors/b3dfb9d442bb28a1.
Report an issue: GitHub.