projectdiscovery/nuclei · error

input cannot be empty file or folder expected

Error message

input cannot be empty file or folder expected

What it means

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.

Source

Thrown at pkg/protocols/file/request.go:58

	Data      string
	Line      int
	ByteIndex int
	Match     bool
	Extract   bool
	Expr      string
	Raw       string
}

var errEmptyResult = errors.New("Empty result")

// ExecuteWithResults executes the protocol requests and returns results instead of writing them.
func (request *Request) ExecuteWithResults(input *contextargs.Context, metadata, previous output.InternalEvent, callback protocols.OutputEventCallback) error {
	wg, err := syncutil.New(syncutil.WithSize(request.options.Options.BulkSize))
	if err != nil {
		return err
	}
	if input.MetaInput.Input == "" {
		return errors.New("input cannot be empty file or folder expected")
	}
	err = request.getInputPaths(input.Context(), input.MetaInput.Input, func(filePath string) {
		wg.Add()
		go func(filePath string) {
			defer wg.Done()

			if IsSMBPath(filePath) {
				request.options.Progress.AddToTotal(1)
				body, err := request.readSMBFile(input.Context(), filePath)
				if err != nil {
					gologger.Error().Msgf("%s\n", err)
					request.options.Progress.IncrementFailedRequestsBy(1)
					return
				}
				reader := strings.NewReader(body)
				event, fileMatches, err := request.processReader(reader, filePath, input, int64(len(body)), previous)
				if err != nil {
					if errors.Is(err, errEmptyResult) {

View on GitHub (pinned to 265b3a3dec)

Solutions

  1. Supply a real file or folder path as the input
  2. Trim and skip empty lines when reading target lists (grep -v '^$' or strings.TrimSpace in code)
  3. In SDK code, guard `if input.MetaInput.Input == "" { continue }` before invoking file protocol execution
Defensive patterns

Strategy: validation

Validate before calling

input := strings.TrimSpace(line)
if input == "" {
    continue // skip blank targets instead of letting the file protocol fail
}

Prevention

When it happens

Trigger: 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.

Common situations: SDK/lib/nuclei users constructing Context objects manually; untrimmed input files with blank lines; CI pipelines passing an unset environment variable as target.

Related errors


AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15). Data as JSON: /api/errors/68fa8939b1729d95. Report an issue: GitHub.