{"record":{"id":"f2ce02205f813c85","repo":"deepset-ai/haystack","slug":"error-reading-file-path-str-e","errorCode":null,"errorMessage":"Error reading {file_path}: {str(e)}","messagePattern":"Error reading (.+?): (.+?)","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"haystack/core/pipeline/breakpoint.py","lineNumber":120,"sourceCode":"    \"\"\"\n    Load a saved pipeline snapshot.\n\n    :param file_path: Path to the pipeline_snapshot file.\n    :returns:\n        Dict containing the loaded pipeline_snapshot.\n    \"\"\"\n\n    file_path = Path(file_path)\n\n    try:\n        with open(file_path, encoding=\"utf-8\") as f:\n            pipeline_snapshot_dict = json.load(f)\n    except FileNotFoundError as e:\n        raise FileNotFoundError(f\"File not found: {file_path}\") from e\n    except json.JSONDecodeError as e:\n        raise json.JSONDecodeError(f\"Invalid JSON file {file_path}: {str(e)}\", e.doc, e.pos) from e\n    except OSError as e:\n        raise OSError(f\"Error reading {file_path}: {str(e)}\") from e\n\n    try:\n        pipeline_snapshot = PipelineSnapshot.from_dict(pipeline_snapshot_dict)\n    except ValueError as e:\n        raise ValueError(f\"Invalid pipeline snapshot from {file_path}: {str(e)}\") from e\n\n    logger.info(\"Successfully loaded the pipeline snapshot from: {file_path}\", file_path=file_path)\n    return pipeline_snapshot\n\n\ndef _save_pipeline_snapshot(\n    pipeline_snapshot: PipelineSnapshot,\n    raise_on_failure: bool = True,\n    snapshot_callback: SnapshotCallback | None = None,\n) -> str | None:\n    \"\"\"\n    Save the pipeline snapshot dictionary to a JSON file, or invoke a custom callback.\n","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/core/pipeline/breakpoint.py#L102-L138","documentation":"load_pipeline_snapshot() wraps OSError when reading the snapshot file fails and re-raises OSError with the path and the OS error text. This distinguishes permission/IO problems from the not-found and invalid-JSON cases handled in neighboring branches.","triggerScenarios":"Calling load_pipeline_snapshot() on a file without read permission, on a directory, on an unreadable network mount, or a device/dis I/O failure while opening/reading the file.","commonSituations":"Snapshot saved by another user with restrictive permissions; file locked or on a disconnected network drive; passing a directory path instead of a JSON file.","solutions":["Fix permissions on the file (chmod/chown) or run as a user with read access.","Verify the path points to a regular file, not a directory or broken mount, and that the storage is reachable.","Copy the snapshot to a local readable location and load it from there."],"exampleFix":"// before\nsnapshot = load_pipeline_snapshot(\"/mnt/net/snapshot.json\")  # mount down\n// after\nimport shutil, os\nlocal = \"/tmp/snapshot.json\"\nshutil.copy(\"/mnt/net/snapshot.json\", local)  # after restoring mount\nsnapshot = load_pipeline_snapshot(local)","handlingStrategy":"try-catch","validationCode":"p = Path(file_path)\nif not p.is_file():\n    raise OSError(f\"Not a readable file: {p}\")\nif not os.access(p, os.R_OK):\n    raise PermissionError(f\"No read permission: {p}\")","typeGuard":"def can_read(path) -> bool:\n    import os\n    from pathlib import Path\n    p = Path(path)\n    return p.is_file() and os.access(p, os.R_OK)","tryCatchPattern":"try:\n    snapshot = load_pipeline_snapshot(file_path)\nexcept OSError as e:\n    logger.error(\"Cannot read snapshot %s: %s\", file_path, e)","preventionTips":["Ensure the process user has read permission on snapshot files","Point load_pipeline_snapshot at regular files, not directories","Store snapshots on reliable local storage, not volatile mounts"],"tags":["haystack","io","permissions","snapshot"],"backgroundTag":"file-read-failed","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}