{"record":{"id":"b637c79dc19cd923","repo":"projectdiscovery/nuclei","slug":"s-is-not-a-valid-extract-type","errorCode":null,"errorMessage":"'%s' is not a valid extract type","messagePattern":"'(.+?)' is not a valid extract type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/templates/types/types.go","lineNumber":198,"sourceCode":"\treturn json.Marshal(stringProtocols)\n}\n\nfunc (protocolTypes ProtocolTypes) String() string {\n\tvar stringTypes []string\n\tfor _, t := range protocolTypes {\n\t\tprotocolMapping := t.String()\n\t\tif protocolMapping != \"\" {\n\t\t\tstringTypes = append(stringTypes, protocolMapping)\n\t\t}\n\n\t}\n\treturn strings.Join(stringTypes, \", \")\n}\n\nfunc setProtocolType(protocolTypes *ProtocolTypes, value string) error {\n\tcomputedType, err := toProtocolType(value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"'%s' is not a valid extract type\", value)\n\t}\n\t*protocolTypes = append(*protocolTypes, computedType)\n\treturn nil\n}\n","sourceCodeStart":180,"sourceCodeEnd":203,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/templates/types/types.go#L180-L203","documentation":"Returned by setProtocolType in pkg/templates/types/types.go when toProtocolType cannot map the given string to a known ProtocolType. It fires both when parsing protocol lists from template YAML (ProtocolTypes.UnmarshalYAML) and when parsing CLI flags wired to ProtocolTypes.Set (e.g. -protocols). The message text 'not a valid extract type' is a copy-paste artifact; the real meaning is 'not a valid protocol type name'. Valid names come from protocolMappings: dns, file, http, offline-http, headless, tcp, workflow, ssl, websocket, whois, code, javascript.","triggerScenarios":"Passing any string not in protocolMappings: 'network' (the network protocol is registered as 'tcp'), 'js' (registered as 'javascript'), 'offlinehttp'/'offline_http' (registered as 'offline-http'), or typos like 'htp'. Concretely: `-protocols network`, `-type tcp,htt`, or a template YAML field typed as ProtocolTypes containing an unknown entry — each reaches setProtocolType, toProtocolType fails, and the error is returned with the offending value in the message.","commonSituations":"Using -protocols/-exclude-protocols on the CLI with the long name 'network' instead of 'tcp'; template authors writing 'js' instead of 'javascript'; custom tooling built on the nuclei SDK feeding user-supplied protocol names straight into ProtocolTypes.Set; copy-pasted YAML with case or spelling drift after nuclei renames a protocol.","solutions":["Correct the protocol name to one of: dns, file, http, offline-http, headless, tcp, workflow, ssl, websocket, whois, code, javascript — note the network protocol is called 'tcp', not 'network'","Run `nuclei -h` or call types.SupportedProtocolsStrings() to see the exact accepted strings for your nuclei version","If the value comes from user input or config, validate it against types.SupportedProtocolsStrings() before passing it to ProtocolTypes.Set or loading the template","Check for stray whitespace or YAML list syntax issues (e.g. 'http, dns,' leaving an empty element) that produce an empty/invalid token"],"exampleFix":"# before\nnuclei -u target.com -protocols network,ssl\n# error: 'network' is not a valid extract type\n\n# after\nnuclei -u target.com -protocols tcp,ssl","handlingStrategy":"validation","validationCode":"import types \"github.com/projectdiscovery/nuclei/v3/pkg/templates/types\"\n\nfunc validateProtocolNames(names []string) error {\n    supported := map[string]bool{}\n    for _, s := range types.SupportedProtocolsStrings() {\n        supported[s] = true\n    }\n    for _, n := range names {\n        if !supported[n] {\n            return fmt.Errorf(\"unsupported protocol %q (note: network protocol is registered as %q)\", n, \"tcp\")\n        }\n    }\n    return nil\n}","typeGuard":"func isValidProtocolName(name string) bool {\n    for _, s := range types.SupportedProtocolsStrings() {\n        if s == name { return true }\n    }\n    return false\n}","tryCatchPattern":"err := protocolTypes.Set(userValue)\nif err != nil {\n    // message is misleading ('extract type') — treat as invalid protocol name\n    return fmt.Errorf(\"bad protocol in config %q: %w (valid: %v)\", userValue, err, types.SupportedProtocolsStrings())\n}","preventionTips":["Whitelist protocol names against types.SupportedProtocolsStrings() before Set/UnmarshalYAML","Remember the canonical names: 'tcp' not 'network', 'javascript' not 'js', 'offline-http' not 'offlinehttp'","Fail fast in config parsing instead of carrying bad strings to scan time"],"tags":["protocol","validation","template","cli-flags"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}