projectdiscovery/nuclei · error
Invalid extractor type: %s
Error message
Invalid extractor type: %s
What it means
Raised by toExtractorTypes when a template extractor's type field, after TrimSpace + ToLower, matches none of extractorMappings. Supported extractor types are exactly: regex, kval, xpath, json, dsl (extractor_types.go:30-36). ExtractorTypeHolder.UnmarshalYAML propagates the error, so template compilation fails.
Source
Thrown at pkg/operators/extractors/extractor_types.go:59
}
// GetSupportedExtractorTypes returns list of supported types
func GetSupportedExtractorTypes() []ExtractorType {
var result []ExtractorType
for index := ExtractorType(1); index < limit; index++ {
result = append(result, index)
}
return result
}
func toExtractorTypes(valueToMap string) (ExtractorType, error) {
normalizedValue := normalizeValue(valueToMap)
for key, currentValue := range extractorMappings {
if normalizedValue == currentValue {
return key, nil
}
}
return -1, errors.New("Invalid extractor type: " + valueToMap)
}
func normalizeValue(value string) string {
return strings.TrimSpace(strings.ToLower(value))
}
func (t ExtractorType) String() string {
return extractorMappings[t]
}
// ExtractorTypeHolder is used to hold internal type of the extractor
type ExtractorTypeHolder struct {
ExtractorType ExtractorType `mapping:"true"`
}
func (holder ExtractorTypeHolder) JSONSchema() *jsonschema.Schema {
gotType := &jsonschema.Schema{
Type: "string",View on GitHub (pinned to 265b3a3dec)
Solutions
- Use one of: regex, kval, xpath, json, dsl
- For JSON path selection use type: json with a json path expression; for CSS/HTML use type: xpath
- Run nuclei -validate to catch it at template load
Example fix
# before
extractors:
- type: jsonpath
jsonpath: ['$.user']
# after
extractors:
- type: json
json: ['$.user'] Defensive patterns
Strategy: validation
Validate before calling
var validExtractorTypes = map[string]bool{"regex": true, "kval": true, "xpath": true, "json": true, "dsl": true}
func extractorTypeOK(s string) bool { return validExtractorTypes[strings.ToLower(strings.TrimSpace(s))] } Prevention
- Maintain a lint rule whitelisting the five extractor types
- Map foreign names (jsonpath->json, css->xpath) in a preprocessing step
When it happens
Trigger: An extractor with type: jsonpath, type: grok, or type: css; any value outside the five-word enum.
Common situations: Names borrowed from other frameworks (jsonpath, css, regex-group); upgrading templates written for forks that added extra extractor kinds.
Related errors
- validation failed for these fields
- Invalid severity: %s
- Invalid matcher 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/663ac1df7cbaf371.
Report an issue: GitHub.