{"record":{"id":"480d2b76ca57d1d7","repo":"projectdiscovery/nuclei","slug":"template-threads-must-be-at-least-1","errorCode":null,"errorMessage":"template threads must be at least 1","messagePattern":"template threads must be at least 1","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/config.go","lineNumber":133,"sourceCode":"}\n\n// Concurrency options\ntype Concurrency struct {\n\tTemplateConcurrency           int // number of templates to run concurrently (per host in host-spray mode)\n\tHostConcurrency               int // number of hosts to scan concurrently  (per template in template-spray mode)\n\tHeadlessHostConcurrency       int // number of hosts to scan concurrently for headless templates  (per template in template-spray mode)\n\tHeadlessTemplateConcurrency   int // number of templates to run concurrently for headless templates (per host in host-spray mode)\n\tJavascriptTemplateConcurrency int // number of templates to run concurrently for javascript templates (per host in host-spray mode)\n\tTemplatePayloadConcurrency    int // max concurrent payloads to run for a template (a good default is 25)\n\tProbeConcurrency              int // max concurrent http probes to run (a good default is 50)\n}\n\n// WithConcurrency sets concurrency options\nfunc WithConcurrency(opts Concurrency) NucleiSDKOptions {\n\treturn func(e *NucleiEngine) error {\n\t\t// minimum required is 1\n\t\tif opts.TemplateConcurrency <= 0 {\n\t\t\treturn errors.New(\"template threads must be at least 1\")\n\t\t}\n\t\tif opts.HostConcurrency <= 0 {\n\t\t\treturn errors.New(\"host concurrency must be at least 1\")\n\t\t}\n\t\tif opts.HeadlessHostConcurrency <= 0 {\n\t\t\treturn errors.New(\"headless host concurrency must be at least 1\")\n\t\t}\n\t\tif opts.HeadlessTemplateConcurrency <= 0 {\n\t\t\treturn errors.New(\"headless template threads must be at least 1\")\n\t\t}\n\t\tif opts.JavascriptTemplateConcurrency <= 0 {\n\t\t\treturn errors.New(\"js must be at least 1\")\n\t\t}\n\t\tif opts.TemplatePayloadConcurrency <= 0 {\n\t\t\treturn errors.New(\"payload concurrency must be at least 1\")\n\t\t}\n\t\tif opts.ProbeConcurrency <= 0 {\n\t\t\treturn errors.New(\"probe concurrency must be at least 1\")","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/lib/config.go#L115-L151","documentation":"parseSMBURL hands the smb:// URL to net/url.Parse; syntax errors - control characters, invalid percent-escapes, malformed IPv6 brackets - surface wrapped as 'parse smb url'. The URL must satisfy Go's URL grammar before the SMB-specific checks run.","triggerScenarios":"smb://host/share/a b.txt (raw space), smb://host/%zz (bad escape sequence), or unencoded control characters anywhere in the URL.","commonSituations":"Unquoted paths with spaces on the command line; hand-assembled URLs missing percent-encoding; clipboard artifacts.","solutions":["Percent-encode unsafe characters (space as %20) in the URL","Quote the full path in the shell to prevent mangling","Pre-validate with url.Parse when generating URLs programmatically"],"exampleFix":"# before\nsmb://host/share/my file.txt\n# after\nsmb://host/share/my%20file.txt","handlingStrategy":"validation","validationCode":"import (\n    \"net/url\"\n    \"strings\"\n)\n\nfunc validSMBURL(raw string) bool {\n    if !strings.HasPrefix(strings.ToLower(raw), \"smb://\") {\n        return true // UNC form; different checks apply\n    }\n    _, err := url.Parse(raw)\n    return err == nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Percent-encode spaces and special bytes in URLs","Shell-quote SMB URLs to prevent mangling","Build URLs with net/url primitives, not string concatenation"],"tags":["smb","url","parsing"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}