usestrix/strix · error · ValueError
--target-list path must not be empty.
Error message
--target-list path must not be empty.
What it means
read_target_list_file validates its input before touching the filesystem: an empty or whitespace-only path string for --target-list is rejected immediately. This distinguishes 'the flag was passed with nothing' from 'the file does not exist', giving an actionable message early.
Source
Thrown at strix/interface/utils.py:1212
raise ValueError(
f"Invalid target: {target}\n"
"Target must be one of:\n"
"- A valid URL (http:// or https://)\n"
"- A Git repository URL (https://host/org/repo or git@host:org/repo.git)\n"
"- A local directory path\n"
"- An API spec file (OpenAPI/Swagger .json/.yaml or a Postman collection)\n"
"- A Postman collection by id (postman://<collection-uid>[?env=<environment-uid>], "
"needs POSTMAN_API_KEY)\n"
"- A domain name (e.g., example.com)\n"
"- An IP address (e.g., 192.168.1.10)"
)
def read_target_list_file(path_str: str) -> list[str]:
"""Read scan targets from a file, one target per non-empty, non-comment line."""
if not path_str or not path_str.strip():
raise ValueError("--target-list path must not be empty.")
path = Path(path_str).expanduser()
if not path.is_file():
raise ValueError(f"Target list file '{path_str}' is not an existing file.")
try:
targets = [
target
for line in path.read_text(encoding="utf-8").splitlines()
if (target := line.strip()) and not target.startswith("#")
]
except UnicodeDecodeError as e:
raise ValueError(f"Target list file '{path_str}' must be valid UTF-8 text: {e!s}") from e
except OSError as e:
raise ValueError(f"Failed to read target list file '{path_str}': {e!s}") from e
targets = [target for target in targets if target]
if not targets:View on GitHub (pinned to 8551339130)
Solutions
- Provide a real path: --target-list targets.txt pointing to a UTF-8 file with one target per line.
- In scripts, default the variable: TARGETS_FILE=${TARGETS_FILE:-targets.txt}.
- Verify the file exists and contains uncommented target lines before the run.
Example fix
# before
strix -n --target-list "$TARGETS_FILE" # unset -> empty string
# after
TARGETS_FILE="${TARGETS_FILE:-targets.txt}"
strix -n --target-list "$TARGETS_FILE" Defensive patterns
Strategy: validation
Validate before calling
path_str = (path_str or "").strip()
if not path_str:
raise SystemExit("--target-list requires a file path")
targets = read_target_list_file(path_str) Type guard
def is_non_empty_path_str(s: object) -> bool:
return isinstance(s, str) and bool(s.strip()) Try / catch
try:
targets = read_target_list_file(path_str)
except ValueError as e:
if "must not be empty" in str(e):
raise SystemExit("Provide --target-list <file> with one target per line") from e
raise Prevention
- Default --target-list variables to a known file in scripts: ${TARGETS_FILE:-targets.txt}
- Fail CI jobs early when configuration variables are unset
When it happens
Trigger: Calling read_target_list_file(''), read_target_list_file(' '), or a CLI invocation where --target-list's value came from an unset shell/env variable.
Common situations: CI YAML like --target-list ${TARGETS_FILE} with the variable unset; a wrapper script echoing an empty default; a stray flag with no argument followed by another flag.
Related errors
- Unsupported scope mode: {scope_mode}
- Target must be a non-empty string
- Invalid target: {target} Target must be one of: - A valid UR
- Target list file '{path_str}' is not an existing file.
- Target list file '{path_str}' is empty.
AI-assisted analysis of usestrix/strix@8551339130 (2026-08-15).
Data as JSON: /api/errors/0626afbf92a33959.
Report an issue: GitHub.