{"record":{"id":"e6c2024ce2f9e3e0","repo":"ComposioHQ/composio","slug":"refusing-to-auto-upload-attempted-the-file-d","errorCode":null,"errorMessage":"Refusing to auto-upload \"${attempted}\": the file does not exist on disk.\n\nPath attempted:   ${attempted}\nResolved to:      ${abs}\nProcess cwd:      ${cwd}\nParent exists:    ${parentExists ? 'yes (' + parent + ')' : 'no (' + parent + ')'}\n\nCommon causes:\n  - Typo in the filename passed to the tool.\n  - Relative path resolved against the wrong working directory\n    (relative paths use process.cwd() at the moment of upload).\n  - File was deleted between the tool being called and the upload starting.\n\n${buildHelpFooter(allowlist)}","messagePattern":"Refusing to auto-upload \"(.+?)\": the file does not exist on disk\\.\n\nPath attempted:   (.+?)\nResolved to:      (.+?)\nProcess cwd:      (.+?)\nParent exists:    (.+?)\n\nCommon causes:\n  - Typo in the filename passed to the tool\\.\n  - Relative path resolved against the wrong working directory\n    \\(relative paths use process\\.cwd\\(\\) at the moment of upload\\)\\.\n  - File was deleted between the tool being called and the upload starting\\.\n\n(.+?)","errorType":"exception","errorClass":"ComposioFileNotFoundError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/utils/uploadDirAllowlist.node.ts","lineNumber":122,"sourceCode":" *         outside every entry of `allowlist`.\n */\nexport function assertPathInsideUploadDirs(filePath: string, allowlist: string[]): void {\n  const attempted = filePath;\n  const abs = path.resolve(filePath);\n  const real = tryRealpath(abs);\n\n  if (!real) {\n    const cwd = process.cwd();\n    const parent = path.dirname(abs);\n    const parentExists = (() => {\n      try {\n        return fs.existsSync(parent);\n      } catch {\n        return false;\n      }\n    })();\n\n    throw new ComposioFileNotFoundError(\n      [\n        `Refusing to auto-upload \"${attempted}\": the file does not exist on disk.`,\n        '',\n        `Path attempted:   ${attempted}`,\n        `Resolved to:      ${abs}`,\n        `Process cwd:      ${cwd}`,\n        `Parent exists:    ${parentExists ? 'yes (' + parent + ')' : 'no (' + 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 process.cwd() at the moment of upload).',\n        '  - File was deleted between the tool being called and the upload starting.',\n        '',\n        buildHelpFooter(allowlist),\n      ].join('\\n'),\n      { meta: { attempted, resolved: abs, cwd, allowlist } }\n    );","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/utils/uploadDirAllowlist.node.ts#L104-L140","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nawait composio.tools.execute('FILE_UPLOAD_TOOL', { filePath: 'uploads/doc.pdf' }); // wrong cwd\n// after\nimport path from 'node:path';\nawait composio.tools.execute('FILE_UPLOAD_TOOL', { filePath: path.resolve('uploads/doc.pdf') });","handlingStrategy":"validation","validationCode":"import fs from 'node:fs'; import path from 'node:path';\nconst p = path.resolve(filePath);\nif (!fs.existsSync(p)) throw new Error(`File not found: ${p} (cwd=${process.cwd()})`);","typeGuard":"const fileExists = (p: string): boolean => { try { return fs.statSync(path.resolve(p)).isFile(); } catch { return false; } };","tryCatchPattern":"catch (e) { if (e instanceof ComposioFileNotFoundError) { /* surface path/cwd details to the model or user, request corrected path */ } throw e; }","preventionTips":["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"],"tags":["file-upload","path-resolution","node","security","filesystem"],"backgroundTag":"file-not-found","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}