ComposioHQ/composio · error · SDKFileNotFoundError

Refusing to auto-upload "{attempted}": the file does not exi

Error message

Refusing to auto-upload "{attempted}": the file does not exist on disk.

What it means

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.

Source

Thrown at python/composio/utils/upload_dir_allowlist.py:156

def assert_path_inside_upload_dirs(
    file_path: t.Union[str, Path],
    allowlist: t.Sequence[Path],
) -> None:
    """Raise an elaborate error if the path is missing or outside the allowlist.

    :raises SDKFileNotFoundError: when ``file_path`` does not exist on disk.
    :raises FileUploadPathNotAllowedError: when resolved path is outside every
        entry of ``allowlist`` (including when allowlist is empty).
    """
    attempted = str(file_path)
    abs_path = resolve_root(attempted)

    if not abs_path.exists():
        cwd = Path.cwd()
        parent = abs_path.parent
        parent_exists = parent.exists()
        raise SDKFileNotFoundError(
            "\n".join(
                [
                    f'Refusing to auto-upload "{attempted}": the file does not exist on disk.',
                    "",
                    f"Path attempted:   {attempted}",
                    f"Resolved to:      {abs_path}",
                    f"Process cwd:      {cwd}",
                    f"Parent exists:    {'yes (' + str(parent) + ')' if parent_exists else 'no (' + str(parent) + ')'}",
                    "",
                    "Common causes:",
                    "  - Typo in the filename passed to the tool.",
                    "  - Relative path resolved against the wrong working directory",
                    "    (relative paths use os.getcwd() at the moment of upload).",
                    "  - File was deleted between the tool being called and the upload starting.",
                    "",
                    _build_help_footer(allowlist),
                ]
            )

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Check existence first: Path(p).resolve().exists() and surface a clear error before calling upload
  2. Use absolute paths constructed from a known root (Path(__file__).parent / 'data' / name)
  3. Ensure the file is fully written/closed (and fsync'd if needed) before upload
  4. Verify cwd assumptions in containers/CI — print Path.cwd() when debugging resolution mismatches

Example fix

# before
upload.from_path("outputs/result.json")  # run from another cwd
# after
from pathlib import Path
p = Path(__file__).parent / "outputs" / "result.json"
assert p.exists(), f"missing {p}"
upload.from_path(str(p))
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
def uploadable_exists(p):
    fp = Path(p).expanduser().resolve()
    return fp.is_file(), fp

Try / catch

from composio.exceptions import SDKFileNotFoundError
try:
    upload.from_path(p)
except SDKFileNotFoundError:
    p = regenerate_file(p)
    upload.from_path(p)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/86a1ae593ef923f8. Report an issue: GitHub.