ComposioHQ/composio · error · ComposioFileNotFoundError
Refusing to auto-upload "${attempted}": the file does not ex
Error message
Refusing to auto-upload "${attempted}": the file does not exist on disk.
Path attempted: ${attempted}
Resolved to: ${abs}
Process cwd: ${cwd}
Parent exists: ${parentExists ? 'yes (' + parent + ')' : 'no (' + parent + ')'}
Common causes:
- Typo in the filename passed to the tool.
- Relative path resolved against the wrong working directory
(relative paths use process.cwd() at the moment of upload).
- File was deleted between the tool being called and the upload starting.
${buildHelpFooter(allowlist)} What it means
assertPathInsideUploadDirs refuses automatic file upload when the given path does not exist on disk (fs check failed), throwing ComposioFileNotFoundError. The message includes the attempted path, resolved absolute path, cwd, and parent-dir existence to make resolution mistakes obvious. This is a security-guarded auto-upload path.
Source
Thrown at ts/packages/core/src/utils/uploadDirAllowlist.node.ts:122
* outside every entry of `allowlist`.
*/
export function assertPathInsideUploadDirs(filePath: string, allowlist: string[]): void {
const attempted = filePath;
const abs = path.resolve(filePath);
const real = tryRealpath(abs);
if (!real) {
const cwd = process.cwd();
const parent = path.dirname(abs);
const parentExists = (() => {
try {
return fs.existsSync(parent);
} catch {
return false;
}
})();
throw new ComposioFileNotFoundError(
[
`Refusing to auto-upload "${attempted}": the file does not exist on disk.`,
'',
`Path attempted: ${attempted}`,
`Resolved to: ${abs}`,
`Process cwd: ${cwd}`,
`Parent exists: ${parentExists ? 'yes (' + parent + ')' : 'no (' + parent + ')'}`,
'',
'Common causes:',
' - Typo in the filename passed to the tool.',
' - Relative path resolved against the wrong working directory',
' (relative paths use process.cwd() at the moment of upload).',
' - File was deleted between the tool being called and the upload starting.',
'',
buildHelpFooter(allowlist),
].join('\n'),
{ meta: { attempted, resolved: abs, cwd, allowlist } }
);View on GitHub (pinned to 64b1b85502)
Solutions
- Compare 'Path attempted' vs 'Resolved to' vs 'Process cwd' in the error to spot resolution issues
- Use an absolute path for the file argument, or ensure the relative path is correct for the process's actual cwd
- Verify with fs.existsSync(path.resolve(arg)) before calling the tool
- Re-create or re-upload the file if it was deleted mid-flight
- If intended, explicitly pre-upload the file and pass its remote URL instead of a local path
Example fix
// before
await composio.tools.execute('FILE_UPLOAD_TOOL', { filePath: 'uploads/doc.pdf' }); // wrong cwd
// after
import path from 'node:path';
await composio.tools.execute('FILE_UPLOAD_TOOL', { filePath: path.resolve('uploads/doc.pdf') }); Defensive patterns
Strategy: validation
Validate before calling
import fs from 'node:fs'; import path from 'node:path';
const p = path.resolve(filePath);
if (!fs.existsSync(p)) throw new Error(`File not found: ${p} (cwd=${process.cwd()})`); Type guard
const fileExists = (p: string): boolean => { try { return fs.statSync(path.resolve(p)).isFile(); } catch { return false; } }; Try / catch
catch (e) { if (e instanceof ComposioFileNotFoundError) { /* surface path/cwd details to the model or user, request corrected path */ } throw e; } Prevention
- Always pass absolute paths to file-argument tools
- Validate existence with fs.existsSync immediately before execution
- Anchor relative paths with path.resolve against a known base dir, not process.cwd() assumptions
When it happens
Trigger: A tool with a file argument is executed and the referenced path doesn't exist: typo'd filename, relative path resolved against an unexpected process.cwd(), or the file was deleted before upload started (getFileDataAfterUploadingToS3).
Common situations: Server-side tool execution where the model hallucinates a path; running under a different cwd (systemd, Docker WORKDIR, serverless); race where cleanup deleted the temp file; Windows/Unix path style mismatch.
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
- Refusing to upload: {reason}. Set sensitive_file_upload_prot
- Refusing to auto-upload "{attempted}": the file does not exi
- Error reading file at ${filePath}: ${error}
- Refusing to upload: ${reason}. ${remediation}
- Refusing to fetch a malformed URL
AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28).
Data as JSON: /api/errors/e6c2024ce2f9e3e0.
Report an issue: GitHub.