https://linen.dev logo
404 "HeadObject operation: Not Found" error when t...
# 🖥│support-forum
o
Issue Summary I am successfully uploading files to Composio's file storage API and the agent is correctly calling the GMAIL_CREATE_EMAIL_DRAFT tool, but we're getting a 404 "HeadObject operation: Not Found" error when the Gmail tool tries to access the uploaded file. File Upload Process (Working) Request:
Copy code
POST https://backend.composio.dev/api/v3/files/upload/request
Content-Type: application/json
x-api-key: [API_KEY]

{
  "toolkit_slug": "GMAIL",
  "tool_slug": "GMAIL_CREATE_EMAIL_DRAFT",
  "filename": "MY_RESUME_2025.pdf",
  "mimetype": "application/pdf",
  "md5": "bffab9a81ec67cf6f4b76b7576fe2bae"
}
Response:
Copy code
{
  "type": "new",
  "id": "19fa6bdb-2eac-4fb9-9b3a-d6ab8e4bc0e1",
  "key": "122445/GMAIL/GMAIL_CREATE_EMAIL_DRAFT/request/bffab9a81ec67cf6f4b76b7576fe2bae"
}
Gmail Tool Execution (Failing) Agent Tool Call:
Copy code
{
  "name": "execute_composio_tool",
  "arguments": {
    "slug": "GMAIL_CREATE_EMAIL_DRAFT",
    "data": {
      "to": [
        "myemail@outlook.com"
      ],
      "subject": "Resume for Review",
      "body": "Dear Hiring Manager,\n\nI hope this message finds you well...",
      "attachment": "122445/GMAIL/GMAIL_CREATE_EMAIL_DRAFT/request/bffab9a81ec67cf6f4b76b7576fe2bae"
    },
    "request_heartbeat": true
  }
}
Tool Response (Error):
Copy code
{
  "status_code": 200,
  "body": {
    "data": {},
    "successful": false,
    "error": "An error occurred (404) when calling the HeadObject operation: Not Found",
    "log_id": "log_G_i3xlbTDkDQ"
  },
  "success": true
}
Key Observations 1) File upload succeeds - Files are uploaded to the correct toolkit/tool location 2) S3 key format - Using the exact key value from the upload response 3) Tool execution - Agent correctly calls GMAIL_CREATE_EMAIL_DRAFT with the S3 key 4) 404 error persists - Gmail tool cannot find the file at the provided S3 location Any help or guidance is appreciated Thanks Joe
c
Hi Joe, We are looking into this. I'll keep you updated. Thanks!
o
I believe the attachment format above was incorrect...I changed it to:
Copy code
"attachment": {
  "s3key": "122445/GMAIL/GMAIL_CREATE_EMAIL_DRAFT/request/bffab9a81ec67cf6f4b76b7576fe2bae", 
  "name": "ANTONECCHIA_RESUME_2025.pdf", 
  "mimetype": "application/pdf"
}
The Composio API is still returning a 404 error: "error": "An error occurred (404) when calling the HeadObject operation: Not Found"
c
It seems like there could be an Issue with the storage of s3Keys. I'll update you!
o
I tried using my own S3 bucket as a work around but it looks like Composio's tools are designed to work with their own file storage, not external S3 buckets...is that true?
a
true. May I ask why you're using the API for file uploads instead of the SDK? The SDK handles this much more conveniently - you just need to specify the file path and it takes care of the rest automatically.
o
I haven’t tried it but I will today.
It looks like the file upload works via the SDK , however I still cant use it to create and email draft with an attachment. I use the key in the file upload response as the s3key value in the attachment.s3key in the GMAIL_CREATE_EMAIL_DRAFT call. from the logs, I can see: ✅ File gets registered in Composio successfully ✅ We get the key: 122445/GMAIL/GMAIL_CREATE_EMAIL_DRAFT/request/bffab9a81ec67cf6f4b76b7576fe2bae ✅ GMAIL tool gets called with the correct s3key ❌ GMAIL tool still gets 404 - "HeadObject operation: Not Found"
a
What SDK are you (TS/Py) & version?
o
typescript "composio-core": "^0.5.39"
a
Thats the old SDK, here's the quickstart for new one: https://docs.composio.dev/docs/quickstart
when you're executing the action like
GMAIL_CREATE_EMAIL_DRAFT
, you can just pass the path of the file you want to upload and rest would be handled by SDK. Do try and lmk if you face any issues
o
Attached is my test script. and the log it produced I am using @composio/core "^0.1.43". Seems to have an issue with direct file uploads . The Composio SDK is trying to read a local file, but it's bundled in a way that prevents Node.js file system access. https://cdn.discordapp.com/attachments/1402826208051200162/1405778039098445844/test-gmail-simple.js?ex=68a01052&is=689ebed2&hm=2b9afe525cfad2c3536ed466384fa1b04c5c6fccb2518bc72f70be7e8a7a2051& https://cdn.discordapp.com/attachments/1402826208051200162/1405778039433855074/script_log.txt?ex=68a01052&is=689ebed2&hm=efc6c7342c30642c43084d411fe99ff47c13dd9a7b3f6052e4e7d9dd45b433ed&
o
This worked! Thanks Uday.
I spoke too soon. It worked once, I run the same script again and it created the draft without the attachment. I even tried a different file. Here is the response: Result: { "data": { "response_data": { "id": "r2735353277234715902", "message": { "id": "198ba05daba1ed50", "labelIds": [ "DRAFT" ], "threadId": "198ba05daba1ed50" } } }, "error": null, "successful": true, "logId": "log_RyauHROI3RaP" }
c
HI Joe, Just to confirm— you've not changed the code snippet and are unable to create a Draft with attachment? lmk if you've altered anything and also try sending the Draft email to confirm.
o
Well. I stand corrected again...The attachment is not indicated in my mail list but when I open the draft it IS there. The one in the list that shows the attachment was the very first successful one. Not sure why the mail client isnt showing the attachment in the latest ones but the attachment IS there when I open the draft.