projectdiscovery/nuclei · error
Invalid matcher type: %s
Error message
Invalid matcher type: %s
What it means
Raised by toMatcherTypes when a template matcher's type field, after TrimSpace + ToLower, matches none of MatcherTypes. Supported matcher types are: status, size, word, regex, binary, dsl, xpath (matchers_types.go:34-42). MatcherTypeHolder.UnmarshalYAML propagates the error, aborting template compilation at load time.
Source
Thrown at pkg/operators/matchers/matchers_types.go:65
}
// GetSupportedMatcherTypes returns list of supported types
func GetSupportedMatcherTypes() []MatcherType {
var result []MatcherType
for index := MatcherType(1); index < limit; index++ {
result = append(result, index)
}
return result
}
func toMatcherTypes(valueToMap string) (MatcherType, error) {
normalizedValue := normalizeValue(valueToMap)
for key, currentValue := range MatcherTypes {
if normalizedValue == currentValue {
return key, nil
}
}
return -1, errors.New("Invalid matcher type: " + valueToMap)
}
func normalizeValue(value string) string {
return strings.TrimSpace(strings.ToLower(value))
}
func (t MatcherType) String() string {
return MatcherTypes[t]
}
// MatcherTypeHolder is used to hold internal type of the matcher
type MatcherTypeHolder struct {
MatcherType MatcherType `mapping:"true"`
}
func (t MatcherTypeHolder) String() string {
return t.MatcherType.String()
}View on GitHub (pinned to 265b3a3dec)
Solutions
- Use one of: status, size, word, regex, binary, dsl, xpath
- Match headers with type: word plus part: header; match body text with type: word plus part: body
- Run nuclei -validate on the template before scanning
Example fix
# before
matchers:
- type: header
header:
- 'X-Powered-By: Express'
# after
matchers:
- type: word
part: header
words:
- 'X-Powered-By: Express' Defensive patterns
Strategy: validation
Validate before calling
var validMatcherTypes = map[string]bool{"status": true, "size": true, "word": true, "regex": true, "binary": true, "dsl": true, "xpath": true}
func matcherTypeOK(s string) bool { return validMatcherTypes[strings.ToLower(strings.TrimSpace(s))] } Prevention
- Lint templates for the seven matcher types
- Remember 'part: header/body' composes with word/regex instead of dedicated types
When it happens
Trigger: A matcher with type: header, type: body, or type: status-code; any value outside the seven-word enum.
Common situations: Intuitive but unsupported names ('header', 'body', 'favicon'); templates ported from other tools; condition words ('and', 'or') pasted into the type slot.
Related errors
- validation failed for these fields
- Invalid severity: %s
- Invalid extractor type: %s
- Invalid DNS request type: %s
- Invalid action type: %s
AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15).
Data as JSON: /api/errors/1ccadfec0bd2d30e.
Report an issue: GitHub.