{"record":{"id":"a30ee84221f039ea","repo":"projectdiscovery/nuclei","slug":"unknown-extractor-type-specified-s","errorCode":null,"errorMessage":"unknown extractor type specified: %s","messagePattern":"unknown extractor type specified: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/operators/extractors/compile.go","lineNumber":19,"sourceCode":"package extractors\n\nimport (\n\t\"fmt\"\n\t\"regexp\"\n\t\"strings\"\n\n\t\"github.com/itchyny/gojq\"\n\t\"github.com/projectdiscovery/govaluate\"\n\t\"github.com/projectdiscovery/nuclei/v3/pkg/operators/cache\"\n\t\"github.com/projectdiscovery/nuclei/v3/pkg/operators/common/dsl\"\n)\n\n// CompileExtractors performs the initial setup operation on an extractor\nfunc (e *Extractor) CompileExtractors() error {\n\t// Set up the extractor type\n\tcomputedType, err := toExtractorTypes(e.GetType().String())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unknown extractor type specified: %s\", e.Type)\n\t}\n\te.extractorType = computedType\n\n\tif e.extractorType == RegexExtractor && e.RegexGroup < 0 {\n\t\treturn fmt.Errorf(\"regex extractor group must be >= 0, got %d\", e.RegexGroup)\n\t}\n\n\t// Compile the regexes\n\tfor _, regex := range e.Regex {\n\t\tif cached, err := cache.Regex().GetIFPresent(regex); err == nil && cached != nil {\n\t\t\te.regexCompiled = append(e.regexCompiled, cached)\n\t\t\tcontinue\n\t\t}\n\t\tcompiled, err := regexp.Compile(regex)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not compile regex: %s\", regex)\n\t\t}\n\t\t_ = cache.Regex().Set(regex, compiled)","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/operators/extractors/compile.go#L1-L37","documentation":"Template compilation error from Extractor.CompileExtractors (pkg/operators/extractors/compile.go:19). The extractor's `type:` string is mapped via toExtractorTypes, which normalizes (trim+lowercase) and compares against the closed set {regex, kval, xpath, json, dsl}. Anything else — including an omitted `type:` (zero-value String() is \"\") — returns this error and the template fails to compile.","triggerScenarios":"An extractor block with `type: kval ` misspelled values like `type: json-q`, legacy names like `type: JSONQuery`, or a missing `type:` field when only regex/kval/xpath/json/dsl are accepted.","commonSituations":"Hand-writing templates and typo-ing the type; porting templates from other tools that use different type names; YAML indentation placing `type:` under the wrong nesting so it never unmarshals; upgrading nuclei versions where a previously informal type name is not in the enum.","solutions":["Set `type:` to one of exactly: regex, kval, xpath, json, or dsl","Check YAML indentation so `type:` sits directly under the extractor item","Run `nuclei -validate -t template.yaml` (or `make template-validate`) to catch it before scanning","If embedding via the SDK, log the failing e.Type value — the error prints the raw, un-normalized string"],"exampleFix":"# before\nextractors:\n  - type: JSON\n    json:\n      - '.token'\n# after\nextractors:\n  - type: json\n    json:\n      - '.token'","handlingStrategy":"validation","validationCode":"import (\n  \"strings\"\n  ea \"github.com/projectdiscovery/nuclei/v3/pkg/operators/extractors\"\n)\n\nvar validExtractorTypes = map[string]bool{\"regex\": true, \"kval\": true, \"xpath\": true, \"json\": true, \"dsl\": true}\n\nfunc extractorTypeOK(t string) bool { return validExtractorTypes[strings.ToLower(strings.TrimSpace(t))] }","typeGuard":"type ExtractorSpec struct{ Type string; Regex []string; JSON []string; KVal []string; DSL []string }\n\nfunc (e ExtractorSpec) Valid() bool { return extractorTypeOK(e.Type) }","tryCatchPattern":"if err := ex.CompileExtractors(); err != nil {\n\tif strings.HasPrefix(err.Error(), \"unknown extractor type\") {\n\t\t// template-authoring error: reject the template with file/line context\n\t}\n\treturn err\n}","preventionTips":["Always run nuclei -validate / template-validate in CI for template repos","Generate templates from typed structs or schema-aware editors, not free-form YAML","Keep the allowed set (regex,kval,xpath,json,dsl) visible in PR templates/review checklists"],"tags":["extractor","template","compile-time","yaml","validation"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}