{"record":{"id":"af8dd101a446a236","repo":"opendataloader-project/opendataloader-pdf","slug":"input-file-not-found-input-path","errorCode":null,"errorMessage":"Input file not found: {input_path}","messagePattern":"Input file not found: (.+?)","errorType":"validation","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"python/opendataloader-pdf-mcp/src/opendataloader_pdf_mcp/server.py","lineNumber":77,"sourceCode":"        text_page_separator: Separator between pages in text output.\n        html_page_separator: Separator between pages in HTML output.\n        image_output: Image output mode. Values: off, embedded, external.\n        image_format: Image format. Values: png, jpeg.\n        include_header_footer: Include page headers and footers in output.\n        detect_strikethrough: Detect strikethrough text (experimental).\n        hybrid: Hybrid backend. Values: off, docling-fast.\n        hybrid_mode: Hybrid triage mode. Values: auto, full.\n        hybrid_url: Hybrid backend server URL.\n        hybrid_timeout: Hybrid backend timeout in milliseconds.\n        hybrid_fallback: Enable Java fallback on hybrid backend error.\n        image_dir: Directory path to save extracted images.\n\n    Returns:\n        The converted content as text.\n    \"\"\"\n    input_file = Path(input_path).expanduser().resolve()\n    if not input_file.is_file():\n        raise FileNotFoundError(f\"Input file not found: {input_path}\")\n\n    # Determine output file extension from format\n    ext_map = {\n        \"json\": \".json\",\n        \"text\": \".txt\",\n        \"html\": \".html\",\n        \"markdown\": \".md\",\n        \"markdown-with-html\": \".md\",\n        \"markdown-with-images\": \".md\",\n    }\n    if format not in ext_map:\n        raise ValueError(\n            f\"Unsupported format: {format!r}. \"\n            f\"Supported formats: {', '.join(ext_map)}\"\n        )\n    ext = ext_map[format]\n\n    with tempfile.TemporaryDirectory() as tmp_dir:","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/opendataloader-project/opendataloader-pdf/blob/a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8/python/opendataloader-pdf-mcp/src/opendataloader_pdf_mcp/server.py#L59-L95","documentation":"FileNotFoundError raised by the MCP convert tool after Path(input_path).expanduser().resolve() when the resolved path is not a regular file. Because expanduser+resolve run first, the message echoes the ORIGINAL input_path (which may differ from the resolved absolute path), and symlinks/relative paths are resolved against the MCP server's cwd.","triggerScenarios":"Calling the MCP server's convert tool with a path that does not exist on disk, a broken symlink, a path relative to a different cwd than the server runs in, or a path with a typo.","commonSituations":"Client sends a relative path assuming the user's home, but the server resolves from its own working directory. A path with a typo or wrong extension. An NFS/mount path not available inside the server's container. A deleted file referenced by a stale bookmark.","solutions":["Send an absolute path to the MCP tool to avoid cwd-dependent resolution.","Verify the file exists from the server's perspective: ensure the path is reachable by the process running the MCP server (mounts, permissions).","Check for typos and the correct extension (.pdf).","If using a symlink, confirm the target exists (readlink -f)."],"exampleFix":"# before: relative path resolved from server cwd, not found\nconvert(input_path=\"~/reports/q3.pdf\")  # '~' expanded but file absent -> error\n# after: absolute, verified path\nconvert(input_path=\"/home/user/reports/q3.pdf\")","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef ensure_input(input_path: str) -> Path:\n    p = Path(input_path).expanduser().resolve()\n    if not p.is_file():\n        raise FileNotFoundError(f\"Input file not found: {input_path}\")\n    return p\n","typeGuard":"def is_valid_input(input_path: str) -> bool:\n    try:\n        return Path(input_path).expanduser().resolve().is_file()\n    except OSError:\n        return False","tryCatchPattern":"try:\n    result = convert(input_path=path, format=\"markdown\")\nexcept FileNotFoundError as e:\n    # message echoes the original input_path\n    return {\"error\": str(e), \"hint\": \"send an absolute, verified path\"}","preventionTips":["Send absolute paths to the MCP tool to avoid cwd-dependent resolution.","Verify Path(...).is_file() on the client side before invoking the tool.","Remember the message echoes the ORIGINAL input_path, not the resolved absolute path."],"tags":["mcp","file-not-found","path","validation","python"],"backgroundTag":null,"analyzedSha":"a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8","analyzedAt":"2026-08-14T05:22:03.953Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}