usestrix/strix · error · ValueError

Target list file '{path_str}' is empty.

Error message

Target list file '{path_str}' is empty.

What it means

Raised when the target list file was read successfully but contains zero usable targets — every line was blank or a '#' comment. Strix refuses to start a multi-target scan with an empty workload rather than exiting as a pointless clean run.

Source

Thrown at strix/interface/utils.py:1231

    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:
        raise ValueError(f"Target list file '{path_str}' is empty.")
    return targets


def sanitize_name(name: str) -> str:
    sanitized = re.sub(r"[^A-Za-z0-9._-]", "-", name.strip())
    return sanitized or "target"


def derive_repo_base_name(repo_url: str) -> str:
    if repo_url.endswith("/"):
        repo_url = repo_url[:-1]

    if ":" in repo_url and repo_url.startswith("git@"):
        path_part = repo_url.split(":", 1)[1]
    else:
        path_part = urlparse(repo_url).path or repo_url

    candidate = path_part.split("/")[-1]

View on GitHub (pinned to 8551339130)

Solutions

  1. Uncomment or add at least one valid target line (one target per line, '#' starts a comment).
  2. If the list is generated, verify the generator produced content: wc -l and grep -vc '^[[:space:]]*#' targets.txt.
  3. Skip the --target-list flag entirely if you only need a single target and pass -t instead.

Example fix

# targets.txt - before
# https://example-a.com
# https://example-b.com

# targets.txt - after
https://example-a.com
https://example-b.com
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

lines = [l.strip() for l in Path(path_str).read_text(encoding="utf-8").splitlines()]
usable = [l for l in lines if l and not l.startswith("#")]
if not usable:
    raise SystemExit(f"{path_str} has no active targets; uncomment at least one line")
targets = read_target_list_file(path_str)

Try / catch

try:
    targets = read_target_list_file(path_str)
except ValueError as e:
    if "is empty" in str(e):
        raise SystemExit("Target list has no uncommented lines; add targets or drop --target-list.") from e
    raise

Prevention

When it happens

Trigger: A file containing only blank lines; all lines prefixed with '#' (e.g. everything commented out during debugging); a file of only whitespace after stripping.

Common situations: Commenting out all targets while testing and forgetting to restore them; template files shipped with only comments; lists generated by a previous pipeline step that produced no output.

Related errors


AI-assisted analysis of usestrix/strix@8551339130 (2026-08-15). Data as JSON: /api/errors/4192c7a30376235a. Report an issue: GitHub.