zylon-ai/private-gpt · error · FileNotFoundError

File not found: {file_data}

Error message

File not found: {file_data}

What it means

FileNotFoundError raised by get_file_info when the Path passed to ingestion does not exist on disk (exist_file check fails). This happens before any file metadata is gathered — the file was never there, was deleted, or the path is wrong.

Source

Thrown at private_gpt/components/ingest/utils.py:378

    file_metadata: dict[str, Any] | None,
) -> str | None:
    # Extracting the file name to help detect the file type through the extension
    file_name: str | None = (
        file_metadata.get(MetadataKeys.FILENAME.value) if file_metadata else None
    )
    # In case the file name does not contain an extension, we discard it
    if file_name and len(Path(file_name).suffix) == 0:
        file_name = None

    return file_name


def get_file_info(
    file_data: Path, file_name: str | None, progress: NotifyProtocol | None = None
) -> FileInfo:
    """Function to extract file information."""
    if not exist_file(file_data):
        raise FileNotFoundError(f"File not found: {file_data}")

    steps = 7
    current_step = 0

    def notify() -> None:
        if progress is None:
            return
        nonlocal current_step
        current_step += 1
        if current_step <= steps:
            progress(percentage=current_step * 100 // steps)

    file_name = file_name
    extension = get_extension(file_name) if file_name else None
    notify()

    file_size = get_filesize(file_data)
    notify()

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Verify the path exists on the machine actually executing ingestion (worker node), not just the API node.
  2. Share uploads via a common volume or object storage across API and workers.
  3. Check that nothing (cron cleanup, tmp reaper) deletes staged files between upload and parse.
  4. Log the resolved absolute path right before ingest to catch normalization bugs.

Example fix

// before
nodes = parser.file_to_nodes(file_info)  # path may be stale

// after
from pathlib import Path
if not file_info.file_data.exists():
    raise FileNotFoundError(f"staged file vanished: {file_info.file_data}")
nodes = parser.file_to_nodes(file_info)
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
p = Path(file_path).resolve()
if not p.is_file():
    raise FileNotFoundError(f'ingest input missing on this host: {p}')

Try / catch

try:
    file_info = get_file_info(path, file_name=name)
except FileNotFoundError as e:
    logger.error('staged file vanished or wrong volume: %s', e)
    retry_with_fresh_upload()

Prevention

When it happens

Trigger: Calling get_file_info (directly or via the validate/ingest pipeline) with a Path that does not exist: wrong path string, file already cleaned up by a temp-dir reaper, or a worker on a different host without the shared volume.

Common situations: Multi-node deployments where the API server saves the upload locally but the Celery worker cannot see that path; temp file deleted before async processing starts; path traversal/normalization bugs producing nonexistent paths.

Related errors


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