{"record":{"id":"aa7f3a3bf59c8eed","repo":"zylon-ai/private-gpt","slug":"path-args-folder-does-not-exist","errorCode":null,"errorMessage":"Path {args.folder} does not exist","messagePattern":"Path (.+?) does not exist","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/ingest_folder.py","lineNumber":135,"sourceCode":")\n\nargs = parser.parse_args()\n\n# Set up logging to a file if a path is provided\nif args.log_file:\n    file_handler = logging.FileHandler(args.log_file, mode=\"a\")\n    file_handler.setFormatter(\n        logging.Formatter(\n            \"[%(asctime)s.%(msecs)03d] [%(levelname)s] %(message)s\",\n            datefmt=\"%Y-%m-%d %H:%M:%S\",\n        )\n    )\n    logger.addHandler(file_handler)\n\nif __name__ == \"__main__\":\n    root_path = Path(args.folder)\n    if not root_path.exists():\n        raise ValueError(f\"Path {args.folder} does not exist\")\n\n    global_injector = get_global_injector()\n    ingest_service = global_injector.get(IngestService)\n    settings = global_injector.get(Settings)\n    worker = LocalIngestWorker(ingest_service, settings)\n    worker.ingest_folder(root_path, args.ignored)\n\n    if args.ignored:\n        logger.info(f\"Skipping following files and directories: {args.ignored}\")\n\n    if args.watch:\n        logger.info(f\"Watching {args.folder} for changes, press Ctrl+C to stop...\")\n        directories_to_watch = [\n            dir\n            for dir in root_path.iterdir()\n            if dir.is_dir() and dir.name not in args.ignored\n        ]\n        watcher = IngestWatcher(args.folder, worker.ingest_on_watch)","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/scripts/ingest_folder.py#L117-L153","documentation":"Raised at script startup in scripts/ingest_folder.py (__main__ block) when the positional --folder argument points to a path that does not exist on disk. The check runs before the DI container is built, so it fails fast before any model/embedding initialization, giving a cheap guard against typos and wrong mounts.","triggerScenarios":"python scripts/ingest_folder.py ./data/docs from a different working directory where the relative path does not resolve; typos in the folder argument; container runs where the volume was not mounted at the expected path; CI job on a fresh runner without the synced corpus.","commonSituations":"Relative paths breaking when the script is launched from another cwd; Docker mounts configured to a different container path than the CLI argument; NFS/network shares not yet mounted when the job starts; scripts reused across environments with different layouts.","solutions":["Verify the path exists: ls -la <folder> from the same shell/working directory you launch the script","Use an absolute path for --folder","In containers, confirm the volume is mounted where expected (docker inspect / kubectl describe) and pass the container-side path","If the path is created dynamically, ensure the creation step runs before this script"],"exampleFix":"# before\npython scripts/ingest_folder.py ./documents\n\n# after\npython scripts/ingest_folder.py /srv/corpus/documents","handlingStrategy":"validation","validationCode":"import argparse, os\nfrom pathlib import Path\n\np = argparse.ArgumentParser()\np.add_argument(\"folder\")\nargs = p.parse_args()\nroot = Path(args.folder).expanduser().resolve()\nif not root.is_dir():\n    raise SystemExit(f\"{root} does not exist; check mounts and cwd={os.getcwd()}\")","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Pass absolute paths to scripts/ingest_folder.py","In containers, verify the volume mount target equals the path passed on the CLI","For network-backed corpora, gate the job on the mount being present (mountpoint -q /srv/corpus)"],"tags":["ingestion","filesystem","scripts","startup"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}