{"record":{"id":"c1f9b67d1909ec5d","repo":"deepset-ai/haystack","slug":"file-not-found-file-path","errorCode":null,"errorMessage":"File not found: {file_path}","messagePattern":"File not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"haystack/core/pipeline/breakpoint.py","lineNumber":116,"sourceCode":"    )\n\n\ndef load_pipeline_snapshot(file_path: str | Path) -> PipelineSnapshot:\n    \"\"\"\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,","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/core/pipeline/breakpoint.py#L98-L134","documentation":"load_pipeline_snapshot() opens the given path to read a JSON snapshot and re-raises FileNotFoundError with the resolved path when the file does not exist. It exists so callers resuming from a saved breakpoint get a clear message naming the missing file.","triggerScenarios":"Calling load_pipeline_snapshot(\"path/to/snapshot.json\") with a non-existent path; wrong working directory when a relative path is used; file deleted between save and resume.","commonSituations":"Typo in the snapshot file name; running the resume from a different cwd so a relative path no longer resolves; cleanup scripts removing tmp snapshot files before resume.","solutions":["Verify the file exists and fix the path: os.path.exists() / Path(file_path).resolve() before loading.","Use absolute paths when saving and resuming snapshots to avoid cwd differences.","Catch FileNotFoundError around load_pipeline_snapshot and prompt the user to re-save the snapshot."],"exampleFix":"// before\nsnapshot = load_pipeline_snapshot(\"snapshot.json\")\n// after\nfrom pathlib import Path\np = Path(\"snapshots\").resolve() / \"snapshot.json\"\nif not p.exists():\n    raise SystemExit(f\"Snapshot missing: {p}\")\nsnapshot = load_pipeline_snapshot(str(p))","handlingStrategy":"try-catch","validationCode":"from pathlib import Path\np = Path(file_path)\nif not p.is_file():\n    raise FileNotFoundError(f\"Snapshot missing: {p.resolve()}\")","typeGuard":"def snapshot_file_exists(path) -> bool:\n    from pathlib import Path\n    return Path(path).is_file()","tryCatchPattern":"try:\n    snapshot = load_pipeline_snapshot(file_path)\nexcept FileNotFoundError as e:\n    logger.error(\"Snapshot file missing: %s\", e)","preventionTips":["Check Path(file_path).is_file() before loading","Use absolute paths when saving snapshots","Avoid cleaning temp snapshot directories before resume completes"],"tags":["haystack","file-not-found","snapshot","io"],"backgroundTag":"file-not-found","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}