{"record":{"id":"1d9a3f40dbc49811","repo":"usestrix/strix","slug":"target-list-file-path-str-is-not-an-existing-f","errorCode":null,"errorMessage":"Target list file '{path_str}' is not an existing file.","messagePattern":"Target list file '(.+?)' is not an existing file\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"strix/interface/utils.py","lineNumber":1216,"sourceCode":"        \"- A valid URL (http:// or https://)\\n\"\n        \"- A Git repository URL (https://host/org/repo or git@host:org/repo.git)\\n\"\n        \"- A local directory path\\n\"\n        \"- An API spec file (OpenAPI/Swagger .json/.yaml or a Postman collection)\\n\"\n        \"- A Postman collection by id (postman://<collection-uid>[?env=<environment-uid>], \"\n        \"needs POSTMAN_API_KEY)\\n\"\n        \"- A domain name (e.g., example.com)\\n\"\n        \"- An IP address (e.g., 192.168.1.10)\"\n    )\n\n\ndef read_target_list_file(path_str: str) -> list[str]:\n    \"\"\"Read scan targets from a file, one target per non-empty, non-comment line.\"\"\"\n    if not path_str or not path_str.strip():\n        raise ValueError(\"--target-list path must not be empty.\")\n\n    path = Path(path_str).expanduser()\n    if not path.is_file():\n        raise ValueError(f\"Target list file '{path_str}' is not an existing file.\")\n\n    try:\n        targets = [\n            target\n            for line in path.read_text(encoding=\"utf-8\").splitlines()\n            if (target := line.strip()) and not target.startswith(\"#\")\n        ]\n    except UnicodeDecodeError as e:\n        raise ValueError(f\"Target list file '{path_str}' must be valid UTF-8 text: {e!s}\") from e\n    except OSError as e:\n        raise ValueError(f\"Failed to read target list file '{path_str}': {e!s}\") from e\n\n    targets = [target for target in targets if target]\n    if not targets:\n        raise ValueError(f\"Target list file '{path_str}' is empty.\")\n    return targets\n\n","sourceCodeStart":1198,"sourceCodeEnd":1234,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/interface/utils.py#L1198-L1234","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running strix from a different directory than where the list lives; CI checkout missing the file because it is gitignored; typos in the filename.","solutions":["Confirm the file exists from the invocation directory: ls -l <path>.","Use an absolute path for --target-list to avoid working-directory issues.","If the file is gitignored or generated, generate/commit it before the scan step."],"exampleFix":"# before\nstrix -n --target-list targets.txt   # run from another cwd\n\n# after\nstrix -n --target-list /home/me/project/targets.txt","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\np = Path(path_str).expanduser()\nif not p.is_file():\n    raise SystemExit(f\"{path_str} is not a file; generate the target list first\")\ntargets = read_target_list_file(path_str)","typeGuard":null,"tryCatchPattern":"try:\n    targets = read_target_list_file(path_str)\nexcept ValueError as e:\n    if \"is not an existing file\" in str(e):\n        raise SystemExit(f\"Target list missing: {path_str}. Create it or fix the path.\") from e\n    raise","preventionTips":["Use absolute paths for --target-list to avoid cwd drift","Ensure the list file is committed or generated before the scan step in CI"],"tags":["filesystem","targets","cli","validation"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}