{"record":{"id":"86a1ae593ef923f8","repo":"ComposioHQ/composio","slug":"refusing-to-auto-upload-attempted-the-file-do","errorCode":null,"errorMessage":"Refusing to auto-upload \"{attempted}\": the file does not exist on disk.","messagePattern":"Refusing to auto-upload \"(.+?)\": the file does not exist on disk\\.","errorType":"exception","errorClass":"SDKFileNotFoundError","httpStatus":null,"severity":"error","filePath":"python/composio/utils/upload_dir_allowlist.py","lineNumber":156,"sourceCode":"\ndef assert_path_inside_upload_dirs(\n    file_path: t.Union[str, Path],\n    allowlist: t.Sequence[Path],\n) -> None:\n    \"\"\"Raise an elaborate error if the path is missing or outside the allowlist.\n\n    :raises SDKFileNotFoundError: when ``file_path`` does not exist on disk.\n    :raises FileUploadPathNotAllowedError: when resolved path is outside every\n        entry of ``allowlist`` (including when allowlist is empty).\n    \"\"\"\n    attempted = str(file_path)\n    abs_path = resolve_root(attempted)\n\n    if not abs_path.exists():\n        cwd = Path.cwd()\n        parent = abs_path.parent\n        parent_exists = parent.exists()\n        raise SDKFileNotFoundError(\n            \"\\n\".join(\n                [\n                    f'Refusing to auto-upload \"{attempted}\": the file does not exist on disk.',\n                    \"\",\n                    f\"Path attempted:   {attempted}\",\n                    f\"Resolved to:      {abs_path}\",\n                    f\"Process cwd:      {cwd}\",\n                    f\"Parent exists:    {'yes (' + str(parent) + ')' if parent_exists else 'no (' + str(parent) + ')'}\",\n                    \"\",\n                    \"Common causes:\",\n                    \"  - Typo in the filename passed to the tool.\",\n                    \"  - Relative path resolved against the wrong working directory\",\n                    \"    (relative paths use os.getcwd() at the moment of upload).\",\n                    \"  - File was deleted between the tool being called and the upload starting.\",\n                    \"\",\n                    _build_help_footer(allowlist),\n                ]\n            )","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/python/composio/utils/upload_dir_allowlist.py#L138-L174","documentation":"assert_path_inside_upload_dirs checks that the path being auto-uploaded exists on disk before evaluating the allowlist; a missing file raises SDKFileNotFoundError with the attempted and resolved paths plus cwd context, refusing to upload a phantom file.","triggerScenarios":"Calling a file-upload flow with a path that doesn't exist: typo, a file not yet created, a path relative to a different working directory, or a race where the file was deleted between listing and uploading.","commonSituations":"Relative paths resolved against an unexpected cwd (daemon, container, notebook); LLM agents hallucinating file paths; outputs written asynchronously not yet flushed; case-sensitive filesystem mismatches; paths from configs pointing at files not present in the current checkout.","solutions":["Check existence first: Path(p).resolve().exists() and surface a clear error before calling upload","Use absolute paths constructed from a known root (Path(__file__).parent / 'data' / name)","Ensure the file is fully written/closed (and fsync'd if needed) before upload","Verify cwd assumptions in containers/CI — print Path.cwd() when debugging resolution mismatches"],"exampleFix":"# before\nupload.from_path(\"outputs/result.json\")  # run from another cwd\n# after\nfrom pathlib import Path\np = Path(__file__).parent / \"outputs\" / \"result.json\"\nassert p.exists(), f\"missing {p}\"\nupload.from_path(str(p))","handlingStrategy":"validation","validationCode":"from pathlib import Path\ndef uploadable_exists(p):\n    fp = Path(p).expanduser().resolve()\n    return fp.is_file(), fp","typeGuard":null,"tryCatchPattern":"from composio.exceptions import SDKFileNotFoundError\ntry:\n    upload.from_path(p)\nexcept SDKFileNotFoundError:\n    p = regenerate_file(p)\n    upload.from_path(p)","preventionTips":["Build absolute paths from a known root, never bare relative names","Assert the file exists (and is closed) immediately before upload","Verify cwd in containers/CI before resolving relative paths"],"tags":["file-upload","file-not-found","path-resolution"],"backgroundTag":"file-not-found","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}