usestrix/strix · error · ValueError

Target list file '{path_str}' is not an existing file.

Error message

Target list file '{path_str}' is not an existing file.

What it means

Raised by read_target_list_file when the expanded path is not an existing regular file. The function deliberately checks is_file() (not exists()) so directories, device nodes, and dead symlinks all fail here with a clear message instead of producing a confusing read error later.

Source

Thrown at strix/interface/utils.py:1216

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

View on GitHub (pinned to 8551339130)

Solutions

  1. Confirm the file exists from the invocation directory: ls -l <path>.
  2. Use an absolute path for --target-list to avoid working-directory issues.
  3. If the file is gitignored or generated, generate/commit it before the scan step.

Example fix

# before
strix -n --target-list targets.txt   # run from another cwd

# after
strix -n --target-list /home/me/project/targets.txt
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

p = Path(path_str).expanduser()
if not p.is_file():
    raise SystemExit(f"{path_str} is not a file; generate the target list first")
targets = read_target_list_file(path_str)

Try / catch

try:
    targets = read_target_list_file(path_str)
except ValueError as e:
    if "is not an existing file" in str(e):
        raise SystemExit(f"Target list missing: {path_str}. Create it or fix the path.") from e
    raise

Prevention

When it happens

Trigger: read_target_list_file('targets.txt') when the file was never created; passing a directory; a relative path evaluated from a different working directory; a symlink whose target was removed.

Common situations: Running strix from a different directory than where the list lives; CI checkout missing the file because it is gitignored; typos in the filename.

Related errors


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