{"record":{"id":"492a781f4f0102ef","repo":"google/tsunami-security-scanner","slug":"one-of-the-following-parameters-is-expected-ip-v4-target-ip","errorCode":null,"errorMessage":"One of the following parameters is expected: --ip-v4-target, --ip-v6-target, --hostname-target, --uri-target","messagePattern":"One of the following parameters is expected: --ip-v4-target, --ip-v6-target, --hostname-target, --uri-target","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"main/src/main/java/com/google/tsunami/main/cli/option/MainCliOptions.java","lineNumber":85,"sourceCode":"    }\n\n    List<String> portScanEnabledTargets = new ArrayList<>();\n    List<String> portScanDisabledTargets = new ArrayList<>();\n    if (ipV4Target != null) {\n      portScanEnabledTargets.add(\"--ip-v4-target\");\n    }\n    if (ipV6Target != null) {\n      portScanEnabledTargets.add(\"--ip-v6-target\");\n    }\n    if (hostnameTarget != null) {\n      portScanEnabledTargets.add(\"--hostname-target\");\n    }\n    if (uriTarget != null) {\n      portScanDisabledTargets.add(\"--uri-target\");\n    }\n\n    if (portScanEnabledTargets.isEmpty() && portScanDisabledTargets.isEmpty()) {\n      throw new ParameterException(\n          \"One of the following parameters is expected: --ip-v4-target, --ip-v6-target,\"\n              + \" --hostname-target, --uri-target\");\n    }\n    if (!portScanEnabledTargets.isEmpty() && !portScanDisabledTargets.isEmpty()) {\n      throw new ParameterException(\n          \"Parameters that require port scan (--ip-v4-target, --ip-v6-target, --hostname-target)\"\n              + \" should not be passed along with parameters that skip port scan (--uri-target)\");\n    }\n  }\n\n  /** Returns the log ID to print in front of the logs. */\n  public String getLogId() {\n    return (logId == null) ? \"\" : (logId + \": \");\n  }\n}\n","sourceCodeStart":67,"sourceCodeEnd":101,"githubUrl":"https://github.com/google/tsunami-security-scanner/blob/363ba87b3543f8ae8e4304d3416818f03da7f262/main/src/main/java/com/google/tsunami/main/cli/option/MainCliOptions.java#L67-L101","documentation":"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.","triggerScenarios":"Running the Tsunami CLI without any of the four target flags (or only with flags like --dump-advisories-path), evaluated at MainCliOptions.java:85.","commonSituations":"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.","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."],"exampleFix":"// before\ntsunami --ssh-cred-file=...\n// after\ntsunami --ip-v4-target=127.0.0.1 --ssh-cred-file=...","handlingStrategy":"validation","validationCode":"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\");","typeGuard":null,"tryCatchPattern":"try { cli.call(); } catch (ParameterException e) { System.err.println(e.getMessage()); System.exit(2); }","preventionTips":["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."],"tags":["cli","missing-argument","picocli","java"],"backgroundTag":"missing-required-argument","analyzedSha":"363ba87b3543f8ae8e4304d3416818f03da7f262","analyzedAt":"2026-09-13T01:50:53.990Z","contentChangedAt":"2026-09-13T01:50:53.990Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}