{"record":{"id":"79dc3461a2b4cfb6","repo":"Stirling-Tools/Stirling-PDF","slug":"no-urls-supplied-use-urls-and-or-urls-file","errorCode":null,"errorMessage":"No URLs supplied. Use --urls and/or --urls-file.","messagePattern":"No URLs supplied\\. Use --urls and/or --urls-file\\.","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"warning","filePath":"scripts/download_pdf_samples.py","lineNumber":97,"sourceCode":"        if not clean or clean.startswith(\"#\"):\n            return\n        if clean not in seen:\n            seen.add(clean)\n            urls.append(clean)\n\n    for url in args.urls:\n        add(url)\n    if args.urls_file:\n        for file in args.urls_file:\n            path = Path(file)\n            if not path.exists():\n                print(f\"[WARN] URL file not found: {file}\", file=sys.stderr)\n                continue\n            with path.open(\"r\", encoding=\"utf-8\") as handle:\n                for line in handle:\n                    add(line)\n    if not urls:\n        raise SystemExit(\"No URLs supplied. Use --urls and/or --urls-file.\")\n    return urls\n\n\ndef sanitize_filename(name: str) -> str:\n    return re.sub(r\"[^A-Za-z0-9._-]+\", \"_\", name).strip(\"_\") or \"download\"\n\n\ndef build_filename(url: str, output_dir: Path) -> Path:\n    parsed = urlparse(url)\n    candidate = Path(unquote(parsed.path)).name\n    if not candidate:\n        candidate = \"download.pdf\"\n    candidate = sanitize_filename(candidate)\n    if not candidate.lower().endswith(\".pdf\"):\n        candidate += \".pdf\"\n    target = output_dir / candidate\n    if not target.exists():\n        return target","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/scripts/download_pdf_samples.py#L79-L115","documentation":"SystemExit raised by download_pdf_samples.py when no URLs were collected after processing --urls and --urls-file arguments. The script requires at least one URL to download; an empty URL set is treated as a usage error.","triggerScenarios":"Running the script with no --urls and no --urls-file, or with --urls-file pointing to files that are all missing/empty (they are skipped with a warning, leaving urls empty).","commonSituations":"Forgot to pass --urls. URL files do not exist (warned and skipped). URL files exist but are empty.","solutions":["Pass at least one URL: --urls https://example.com/sample.pdf.","Verify --urls-file paths exist and contain URLs.","Check for the '[WARN] URL file not found' messages on stderr."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Ensure at least one URL is supplied before running\nif not args.urls and not args.urls_file:\n    raise SystemExit(\"No URLs supplied. Use --urls and/or --urls-file.\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --urls or a non-empty --urls-file.","Verify URL files exist and contain entries.","Watch stderr for '[WARN] URL file not found'."],"tags":["cli","scripts","validation","python"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}