{"record":{"id":"0a72c057a92ba99a","repo":"ComposioHQ/composio","slug":"either-path-or-blob-must-be-provided","errorCode":null,"errorMessage":"Either path or blob must be provided","messagePattern":"Either path or blob must be provided","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/utils/fileUtils.node.ts","lineNumber":302,"sourceCode":"    }\n  }\n  throw new Error('Invalid file type');\n};\n\nexport const getFileDataAfterUploadingToS3 = async (\n  file: File | string,\n  {\n    toolSlug,\n    toolkitSlug,\n    client,\n    sensitiveFileUploadProtection,\n    fileUploadPathDenySegments,\n    fileUploadAllowlist,\n    signal,\n  }: GetFileDataAfterUploadingToS3Options\n): Promise<FileUploadData> => {\n  if (!file) {\n    throw new Error('Either path or blob must be provided');\n  }\n\n  const isLocalPath = typeof file === 'string' && !isHttpUrl(file);\n\n  if (isLocalPath && fileUploadAllowlist !== undefined) {\n    assertPathInsideUploadDirs(file as string, fileUploadAllowlist);\n  }\n\n  if (sensitiveFileUploadProtection !== false && isLocalPath) {\n    assertSafeFileUploadPath(file as string, {\n      additionalDenySegments: fileUploadPathDenySegments,\n    });\n  }\n\n  const fileData = await readFile(file, signal);\n  logger.debug(`Uploading file to S3...`);\n  const s3key = await uploadFileToS3(\n    platform.basename(fileData.fileName),","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/utils/fileUtils.node.ts#L284-L320","documentation":"getFileDataAfterUploadingToS3 requires a truthy file argument (a path string or File/Blob); passing undefined/null/empty string throws immediately before any work starts.","triggerScenarios":"Calling the function with a variable that is undefined because of optional chaining, an empty form field, or a defaulted parameter that never resolved.","commonSituations":"Dynamic tool arguments where a file parameter was omitted by the model, or destructuring mismatches passing the wrong property name.","solutions":["Check the argument is defined before calling; fall back to skipping upload when absent.","If the file is optional in your flow, guard with if (!file) return instead of relying on the error.","Log the caller's arguments to find which code path passes undefined."],"exampleFix":"// before\nawait getFileDataAfterUploadingToS3(maybeFile, {...});\n// after\nif (!file) throw new Error('file argument is required');\nawait getFileDataAfterUploadingToS3(file, {...});","handlingStrategy":"validation","validationCode":"if (!file) throw new TypeError('file is required');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default or assert on the file argument before calling.","Log tool arguments when files come from model output."],"tags":["validation","file-upload","typescript"],"backgroundTag":"missing-required-argument","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}