ComposioHQ/composio · error · SDKFileNotFoundError
File not found: {file}. Please provide a valid file path.
Error message
File not found: {file}. Please provide a valid file path. What it means
from_path resolved the input to a local file path (either it wasn't a URL or the hook returned a local path) but Path.exists() is False, so SDKFileNotFoundError is raised before any network call.
Source
Thrown at python/composio/core/models/_files.py:640
return cls.from_url(client=client, url=path_in, tool=tool, toolkit=toolkit)
# Allowlist check runs BEFORE the denylist / existence checks when enabled,
# so the "configure file_upload_dirs" hint fires first for the common case
# (user has auto-upload on but hasn't configured dirs). Caller passes
# ``None`` to bypass the allowlist (manual upload APIs).
if file_upload_allowlist is not None:
assert_path_inside_upload_dirs(path_in, file_upload_allowlist)
assert_safe_local_file_upload_path(
path_in,
enabled=sensitive_file_upload_protection,
additional_deny_segments=file_upload_path_deny_segments,
)
# Handle as local file path
file = Path(path_in)
if not file.exists():
raise SDKFileNotFoundError(
f"File not found: {file}. Please provide a valid file path."
)
if not file.is_file():
raise SDKFileNotFoundError(
f"Not a file: {file}. Please provide a valid file path."
)
if not os.access(file, os.R_OK):
raise SDKFileNotFoundError(
f"File not readable: {file}. Please check the file permissions."
)
mimetype = mimetypes.guess(file=file)
s3meta = _request_presigned_upload(
client,
filename=file.name,
md5=get_md5(file=file),View on GitHub (pinned to 64b1b85502)
Solutions
- Use absolute paths: Path('x.csv').resolve() before calling from_path.
- Verify existence in your code: if not p.exists(): raise ....
- If a hook rewrites paths, ensure the returned path actually exists.
- Check container/cron WORKDIR and mount paths.
Example fix
# before
file = FileModel.from_path(client, Path('data/input.csv')) # relative, CWD differs
# after
from pathlib import Path
p = Path('data/input.csv').resolve()
assert p.exists(), f'missing {p}'
file = FileModel.from_path(client, p) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
def valid_upload_path(p: str) -> bool:
f = Path(p).resolve()
return f.exists() Type guard
def is_existing_file(p) -> bool:
from pathlib import Path
return Path(p).is_file() Try / catch
from composio.core.models._files import SDKFileNotFoundError
try:
model = FileModel.from_path(client, p)
except SDKFileNotFoundError as e:
if 'File not found' in str(e):
p = locate_file(p) # search, fix, or prompt user
model = FileModel.from_path(client, p)
else:
raise Prevention
- Call Path(p).resolve() and verify existence before from_path.
- Avoid relative paths in cron/containers; anchor to __file__ or absolute config.
- Validate user-supplied paths early in your own layer.
When it happens
Trigger: FileModel.from_path / _upload_file_value with a relative path resolved against a different CWD, a typo, a file that was deleted, or a path returned by a before_file_upload hook that doesn't exist.
Common situations: Running from a different working directory (cron, container WORKDIR) so relative paths break; hook rewriting paths incorrectly; race where the temp file was cleaned up; wrong filename casing on case-sensitive filesystems.
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
- Not a file: {file}. Please provide a valid file path.
- File not readable: {file}. Please check the file permissions
- File upload was aborted because before_file_upload returned
- Failed to fetch file from URL: {e.cause}
- URL returned redirect. Please provide a direct URL to the fi
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/4103ab8babeb1495.
Report an issue: GitHub.