Skip to main content
Question

Claude error: invalid json response body at https://relay.zapier.com/api.anthropic.com/v1/messages reason: Unexpected token < in JSON at position 0

  • August 27, 2024
  • 5 replies
  • 160 views

Thank you, I’ll do that.  I tried building a different version of this using Claude instead of GPT, and it works in testing but then when I take it live and test it I get a new error: invalid json response body at https://relay.zapier.com/api.anthropic.com/v1/messages reason: Unexpected token < in JSON at position 0

 

So now I have apparently two separate issues to work out.  

Did this topic help you find an answer to your question?

5 replies

SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 7415 replies
  • August 28, 2024

Hi @johnphotog 👋

Hope you don’t mind but I’ve moved your post out into it’s own topic so these errors with Anthropic can be addressed separately. 

I did some digging on this end for similar reports of that error and found a case where it was caused by hitting Anthropic's size limits. Specifically in that case our Support team were able to see the “413 Request Entity Too Large” in the full error logs. Though it wasn’t 100% clear if this was due to the file or with the size of the request being made to Anthropic's API. 
 
Given that the files that you’re attempting to send over to Anthropic are under 10 MB, I suspect this is more likely either an issue with the set up of the Anthropic action or potentially a bug. I can see you’ve already reached out to our Support team about this and they’re assisting you in troubleshooting this which is perfect - they have access to the error logs which will hopefully offer some further insight into the exact cause of the error. 

Please do keep us updated on how you get on with them, keen to ensure you’re this gets sorted! 🙂


  • New
  • 2 replies
  • February 13, 2025

Hey, i am also getting this, but my prompt is not large and my image is less than 1mb (claude has 5mb limit). Any idea what is causing this? it is in fact a 413 with the json parsing error. I tried rerunning and it still did not work for me. 


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 7415 replies
  • February 14, 2025

Hi there ​@honeybear 👋

Sorry to hear you’re running into that error as well. I did some checking and found similar cases where it was the token limits that were causing issues. There’s a workaround a customer found which might be worth giving a try:

“A user shared the following workaround to save context history and avoid token limits:

  1. Remove the memory key entirely and create their own context history in Google Sheets. This allows them to manage and trim the length of the context history.
  2. Pass the incoming message through a Google Sheet that stored the old response and appended the new incoming message.
  3. Check the length of the new total message and if it exceeded 25000 bytes (as estimated by a character count), and trim the oldest elements of the concatenated context history to keep it within the limit.
  4. Trimmed message is then passed on to the Anthropics API, and the new incoming response can be passed to the next steps of the Zap.
  5. Store the entire context in the updated context cell in Google Sheets, ready for the next incoming message.

By implementing this workaround, the user was able to control the length of the conversation's context history and keep it within the allowable size limits.”


One thing to note on the above workaround is that the additional Google Sheets actions would mean that more tasks are used, so I’d recommend using Zapier Tables actions instead as they would not count towards the Zaps task usage.

Can you give that a try and let us know if that helps?


  • New
  • 2 replies
  • February 14, 2025

Hey, thanks for getting back. To be honest, that sounds like way too much work. My system prompt is within the claude limits, as it was working without issue before. My system prompt & user prompt have a combined token count of less than 1,000. And the image I am sending is less than 1MB, well within the 5MB limit. I’m just trying to have claude describe an image for me, so do not expect this to be happening. Perhaps it is the length of the image name such as “longNameHere.jpg” but I haven’t tried it. That is the only thing that varies, as I’m processing images that are uploaded by users on typeform. If I get around to testing this and solve it, I will let you know.


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 7415 replies
  • February 17, 2025

Thanks for getting back to me, ​@honeybear! Totally understand—it does sound like your setup should be within the expected limits, especially if it was working before.

If a memory key has been set, it’s possible that this is what’s increasing token usage over time, causing it to eventually hit the limit and error. 🤔 Since a new image is supplied each time, you might not actually need to reference the conversation history. In which case, it might be worth just clearing the value in the Memory Key field to see if that helps—without adding the extra steps from the workaround to store the context history.

That’s also an interesting thought about the image filename length! If you get a chance to test it and that turns out to be the issue, definitely let us know!