zylon-ai/private-gpt · error · ValueError

Path {args.folder} does not exist

Error message

Path {args.folder} does not exist

What it means

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.

Source

Thrown at scripts/ingest_folder.py:135

)

args = parser.parse_args()

# Set up logging to a file if a path is provided
if args.log_file:
    file_handler = logging.FileHandler(args.log_file, mode="a")
    file_handler.setFormatter(
        logging.Formatter(
            "[%(asctime)s.%(msecs)03d] [%(levelname)s] %(message)s",
            datefmt="%Y-%m-%d %H:%M:%S",
        )
    )
    logger.addHandler(file_handler)

if __name__ == "__main__":
    root_path = Path(args.folder)
    if not root_path.exists():
        raise ValueError(f"Path {args.folder} does not exist")

    global_injector = get_global_injector()
    ingest_service = global_injector.get(IngestService)
    settings = global_injector.get(Settings)
    worker = LocalIngestWorker(ingest_service, settings)
    worker.ingest_folder(root_path, args.ignored)

    if args.ignored:
        logger.info(f"Skipping following files and directories: {args.ignored}")

    if args.watch:
        logger.info(f"Watching {args.folder} for changes, press Ctrl+C to stop...")
        directories_to_watch = [
            dir
            for dir in root_path.iterdir()
            if dir.is_dir() and dir.name not in args.ignored
        ]
        watcher = IngestWatcher(args.folder, worker.ingest_on_watch)

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Verify the path exists: ls -la <folder> from the same shell/working directory you launch the script
  2. Use an absolute path for --folder
  3. In containers, confirm the volume is mounted where expected (docker inspect / kubectl describe) and pass the container-side path
  4. If the path is created dynamically, ensure the creation step runs before this script

Example fix

# before
python scripts/ingest_folder.py ./documents

# after
python scripts/ingest_folder.py /srv/corpus/documents
Defensive patterns

Strategy: validation

Validate before calling

import argparse, os
from pathlib import Path

p = argparse.ArgumentParser()
p.add_argument("folder")
args = p.parse_args()
root = Path(args.folder).expanduser().resolve()
if not root.is_dir():
    raise SystemExit(f"{root} does not exist; check mounts and cwd={os.getcwd()}")

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/aa7f3a3bf59c8eed. Report an issue: GitHub.