{"record":{"id":"68fa8939b1729d95","repo":"projectdiscovery/nuclei","slug":"input-cannot-be-empty-file-or-folder-expected","errorCode":null,"errorMessage":"input cannot be empty file or folder expected","messagePattern":"input cannot be empty file or folder expected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/protocols/file/request.go","lineNumber":58,"sourceCode":"\tData      string\n\tLine      int\n\tByteIndex int\n\tMatch     bool\n\tExtract   bool\n\tExpr      string\n\tRaw       string\n}\n\nvar errEmptyResult = errors.New(\"Empty result\")\n\n// ExecuteWithResults executes the protocol requests and returns results instead of writing them.\nfunc (request *Request) ExecuteWithResults(input *contextargs.Context, metadata, previous output.InternalEvent, callback protocols.OutputEventCallback) error {\n\twg, err := syncutil.New(syncutil.WithSize(request.options.Options.BulkSize))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif input.MetaInput.Input == \"\" {\n\t\treturn errors.New(\"input cannot be empty file or folder expected\")\n\t}\n\terr = request.getInputPaths(input.Context(), input.MetaInput.Input, func(filePath string) {\n\t\twg.Add()\n\t\tgo func(filePath string) {\n\t\t\tdefer wg.Done()\n\n\t\t\tif IsSMBPath(filePath) {\n\t\t\t\trequest.options.Progress.AddToTotal(1)\n\t\t\t\tbody, err := request.readSMBFile(input.Context(), filePath)\n\t\t\t\tif err != nil {\n\t\t\t\t\tgologger.Error().Msgf(\"%s\\n\", err)\n\t\t\t\t\trequest.options.Progress.IncrementFailedRequestsBy(1)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\treader := strings.NewReader(body)\n\t\t\t\tevent, fileMatches, err := request.processReader(reader, filePath, input, int64(len(body)), previous)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif errors.Is(err, errEmptyResult) {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/protocols/file/request.go#L40-L76","documentation":"The file protocol executes against concrete filesystem (or SMB) paths, so ExecuteWithResults aborts immediately when input.MetaInput.Input is an empty string. It cannot guess a file or folder, and treating '' as '.' would silently scan the wrong location, so nuclei fails fast instead.","triggerScenarios":"Passing an empty target string (e.g. blank line in the -list file, empty CLI variable, or SDK code calling ExecuteWithResults with an empty MetaInput.Input). Programmatically building contextargs inputs from a loop where a field is unset.","commonSituations":"SDK/lib/nuclei users constructing Context objects manually; untrimmed input files with blank lines; CI pipelines passing an unset environment variable as target.","solutions":["Supply a real file or folder path as the input","Trim and skip empty lines when reading target lists (grep -v '^$' or strings.TrimSpace in code)","In SDK code, guard `if input.MetaInput.Input == \"\" { continue }` before invoking file protocol execution"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"input := strings.TrimSpace(line)\nif input == \"\" {\n    continue // skip blank targets instead of letting the file protocol fail\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Trim and drop empty lines when building target lists","In SDK code, assert non-empty MetaInput.Input before calling file-protocol execution","Feed file protocol inputs from an explicit path inventory, not mixed URL lists"],"tags":["file-protocol","sdk","input-validation"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}