projectdiscovery/nuclei · error
ipv4 and/or ipv6 must be selected
Error message
ipv4 and/or ipv6 must be selected
What it means
The file protocol streams each matched archive member into a temp file (os.CreateTemp) and its deferred cleanup panics if Close fails. A close error after a successful create is abnormal and usually environmental - ENOSPC, NFS I/O errors, or a double close - so nuclei panics rather than silently risk truncated data being matched.
Source
Thrown at internal/runner/options.go:230
// verify that a valid ip version type was selected (4, 6)
if len(options.IPVersion) == 0 {
// add ipv4 as default
options.IPVersion = append(options.IPVersion, "4")
}
var useIPV4, useIPV6 bool
for _, ipv := range options.IPVersion {
switch ipv {
case "4":
useIPV4 = true
case "6":
useIPV6 = true
default:
return fmt.Errorf("unsupported ip version: %s", ipv)
}
}
if !useIPV4 && !useIPV6 {
return errors.New("ipv4 and/or ipv6 must be selected")
}
return nil
}
func validateMissingS3Options(options *types.Options) []string {
var missing []string
if options.AwsBucketName == "" {
missing = append(missing, "AWS_TEMPLATE_BUCKET")
}
if options.AwsProfile == "" {
var missingCreds []string
if options.AwsAccessKey == "" {
missingCreds = append(missingCreds, "AWS_ACCESS_KEY")
}
if options.AwsSecretKey == "" {
missingCreds = append(missingCreds, "AWS_SECRET_KEY")
}
if options.AwsRegion == "" {View on GitHub (pinned to 265b3a3dec)
Solutions
- Free space or point TMPDIR to a larger local volume (export TMPDIR=/data/tmp) and rerun
- Narrow the scan to the failing target to confirm, then exclude that archive via -exclude or file filters
- If it recurs on healthy local disks, capture the panic details and report it upstream
Example fix
# before TMPDIR=/tmp nuclei -t file.yaml -l files.txt # /tmp fills up # after mkdir -p /data/tmp && TMPDIR=/data/tmp nuclei -t file.yaml -l files.txt
Defensive patterns
Strategy: try-catch
Try / catch
defer func() {
if r := recover(); r != nil {
// temp-file cleanup panic (close failure): log and continue with next target
log.Printf("file protocol cleanup panic: %v", r)
}
}()
err := engine.ExecuteWithResults(target, ...)
if err != nil {
log.Printf("execute failed: %v", err)
} Prevention
- Keep TMPDIR local and spacious
- Monitor disk usage during archive scans
- Isolate archive-heavy scans per target so one panic does not kill a batch
When it happens
Trigger: Scanning archives (zip/tar) when TMPDIR fills mid-copy, or TMPDIR lives on a network filesystem that returns I/O errors on close.
Common situations: Long archive-heavy scans exhausting /tmp; containers with small ephemeral disks; TMPDIR pointed at NFS.
Related errors
- encountered errors while performing template validation
- no templates provided for scan
- could not read profile file: %w
- could not create temp directory: %w
- could not create temp secrets file: %w
AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15).
Data as JSON: /api/errors/9d5f73c44bb725ba.
Report an issue: GitHub.