google/tsunami-security-scanner · error · ParameterException
One of the following parameters is expected…
Error message
One of the following parameters is expected: --ip-v4-target, --ip-v6-target, --hostname-target, --uri-target
What it means
MainCliOptions.validate() requires at least one target specification. If no --ip-v4-target, --ip-v6-target, --hostname-target, or --uri-target was supplied, portScanEnabledTargets and portScanDisabledTargets are both empty and a picocli ParameterException is thrown listing the four acceptable flags.
Solutions
- Add exactly one of --ip-v4-target, --ip-v6-target, --hostname-target, or --uri-target to the command line.
- Fix scripts so an empty target variable fails loudly instead of omitting the flag.
- Note port-scan-enabled targets (--ip-v4/--ip-v6/--hostname) are mutually exclusive with --uri-target; pick one style.
Example fix
// before tsunami --ssh-cred-file=... // after tsunami --ip-v4-target=127.0.0.1 --ssh-cred-file=...
Defensive patterns
Strategy: validation
Validate before calling
int targetCount = (ipv4 != null ? 1 : 0) + (ipv6 != null ? 1 : 0) + (host != null ? 1 : 0) + (uri != null ? 1 : 0); if (targetCount == 0) throw new IllegalArgumentException("A target flag is required"); Try / catch
try { cli.call(); } catch (ParameterException e) { System.err.println(e.getMessage()); System.exit(2); } Prevention
- Fail scripts early if the TARGET variable is empty.
- Quote shell variables so empty values still pass --ip-v4-target="" only if intentional.
- Document that one target flag is mandatory.
When it happens
Trigger: Running the Tsunami CLI without any of the four target flags (or only with flags like --dump-advisories-path), evaluated at MainCliOptions.java:85.
Common situations: Forgetting the target flag in CI pipelines; passing only --scan-info-local-port or auxiliary options; script variable holding the target left empty so the flag is silently omitted.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Remote plugin server port out of range. Expected
- Malformed GCS URL
- Error loading config.
- Language server path
- Port out of range. Expected
AI-assisted analysis of google/tsunami-security-scanner@363ba87b35 (2026-09-13).
Data as JSON: /api/errors/492a781f4f0102ef.
Report an issue: GitHub.
Appendix: source
Thrown at main/src/main/java/com/google/tsunami/main/cli/option/MainCliOptions.java:85
}
List<String> portScanEnabledTargets = new ArrayList<>();
List<String> portScanDisabledTargets = new ArrayList<>();
if (ipV4Target != null) {
portScanEnabledTargets.add("--ip-v4-target");
}
if (ipV6Target != null) {
portScanEnabledTargets.add("--ip-v6-target");
}
if (hostnameTarget != null) {
portScanEnabledTargets.add("--hostname-target");
}
if (uriTarget != null) {
portScanDisabledTargets.add("--uri-target");
}
if (portScanEnabledTargets.isEmpty() && portScanDisabledTargets.isEmpty()) {
throw new ParameterException(
"One of the following parameters is expected: --ip-v4-target, --ip-v6-target,"
+ " --hostname-target, --uri-target");
}
if (!portScanEnabledTargets.isEmpty() && !portScanDisabledTargets.isEmpty()) {
throw new ParameterException(
"Parameters that require port scan (--ip-v4-target, --ip-v6-target, --hostname-target)"
+ " should not be passed along with parameters that skip port scan (--uri-target)");
}
}
/** Returns the log ID to print in front of the logs. */
public String getLogId() {
return (logId == null) ? "" : (logId + ": ");
}
}
View on GitHub (pinned to 363ba87b35)