{"record":{"id":"a77287b603672d93","repo":"projectdiscovery/nuclei","slug":"validation-failed-for-these-fields","errorCode":null,"errorMessage":"validation failed for these fields","messagePattern":"validation failed for these fields","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/runner/options.go","lineNumber":153,"sourceCode":"\t\t}\n\t}\n\n\tif options.OfflineHTTP {\n\t\toptions.DisableHTTPProbe = true\n\t}\n}\n\n// validateOptions validates the configuration options passed\nfunc ValidateOptions(options *types.Options) error {\n\tif err := validateOptions.Struct(options); err != nil {\n\t\tif _, ok := err.(*validator.InvalidValidationError); ok {\n\t\t\treturn err\n\t\t}\n\t\terrs := []string{}\n\t\tfor _, err := range err.(validator.ValidationErrors) {\n\t\t\terrs = append(errs, err.Namespace()+\": \"+err.Tag())\n\t\t}\n\t\treturn errors.Wrap(errors.New(strings.Join(errs, \", \")), \"validation failed for these fields\")\n\t}\n\tif options.Verbose && options.Silent {\n\t\treturn errors.New(\"both verbose and silent mode specified\")\n\t}\n\n\tif (options.HeadlessOptionalArguments != nil || options.ShowBrowser || options.UseInstalledChrome) && !options.Headless {\n\t\treturn errors.New(\"headless mode (-headless) is required if -ho, -sb, -sc or -lha are set\")\n\t}\n\n\tif options.FollowHostRedirects && options.FollowRedirects {\n\t\treturn errors.New(\"both follow host redirects and follow redirects specified\")\n\t}\n\tif options.ShouldFollowHTTPRedirects() && options.DisableRedirects {\n\t\treturn errors.New(\"both follow redirects and disable redirects specified\")\n\t}\n\t// loading the proxy server list from file or cli and test the connectivity\n\tif err := loadProxyServers(options); err != nil {\n\t\treturn err","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/internal/runner/options.go#L135-L171","documentation":"Thrown by generators.ValidatePayloads when a template declares a payload as an inline list but types.ToStringSlice yields zero elements. Nuclei iterates payload values to build requests, so an empty payload cannot generate any work and template validation aborts. It fires at compile/validate time, before any network activity.","triggerScenarios":"A template payload defined as an empty YAML list (payloads: {name: []}), or a list whose entries are all null (~) which ToStringSlice drops. Surfaces when running nuclei -validate or when loading the template for a scan.","commonSituations":"Template authoring with a placeholder payload never filled in; converting a file-based wordlist to inline form and leaving it empty; CI template-validation pipelines failing on a new template.","solutions":["Add at least one non-empty entry to the inline payload list","If the payload is meant to be a wordlist, reference a file instead (payloads: {name: [wordlist.txt]})","Remove null or empty entries that ToStringSlice silently drops","Run nuclei -validate -t template.yaml after the fix to confirm"],"exampleFix":"# before\npayloads:\n  username: []\n# after\npayloads:\n  username:\n    - admin\n    - root","handlingStrategy":"validation","validationCode":"import (\n    \"fmt\"\n    \"strings\"\n)\n\n// Check inline template payloads before handing the template to nuclei.\nfunc payloadsNonEmpty(payloads map[string]interface{}) error {\n    for name, v := range payloads {\n        if list, ok := v.([]interface{}); ok {\n            usable := 0\n            for _, e := range list {\n                if s, ok := e.(string); ok && strings.TrimSpace(s) != \"\" {\n                    usable++\n                }\n            }\n            if usable == 0 {\n                return fmt.Errorf(\"payload %s is an empty list\", name)\n            }\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run nuclei -validate on every template change","Never ship payloads: {name: []} placeholders","Prefer file-based wordlists for real data"],"tags":["template","payload","yaml","validation"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}