Hello, I'm having an issue with the AI enrichment across all LLMs models. I'm trying to output a JSON array but it keeps throwing an Invalid Request error. The error is resolved if the JSON schema is structured as a string for some reason. https://app.clay.com/workspaces/215094/workbooks/wb_0sw5jksNTbmkeDWz5uQ/tables/t_0swk8s9ftivMvbZZ7b7/views/gv_0swk8sd2pjYNaR5dPyk
The "Invalid Request" error with JSON arrays is typically caused by formatting issues in your JSON structure. Common causes include:
• Missing quotes around keys and string values
• Extra commas at the end of objects or arrays
• Incorrect bracket/brace matching
• Unescaped special characters
Quick fixes:
** Ensure all keys use double quotes: "key": "value"
** Remove trailing commas: {"name": "John", "age": 30}
not {"name": "John", "age": 30,}
* Validate syntax with JSONLint
For HTTP API enrichments specifically, make sure dynamic column references are properly quoted in the body section.
Could you copy and paste your JSON structure into the chat so I can help identify the specific formatting issue?
here's the json structure: { "type": "array", "items": { "type": "object", "properties": { "lead_id": { "type": "string" }, "activities": { "type": "array","items": { "type": "object", "properties": { "activity_type": { "type": "string" }, "activity_timestamp": { "type": "string" },"activity_content": { "type": "string" } }, "required": [ "activity_type", "activity_timestamp", "activity_content" ],"additionalProperties": false } } }, "required": [ "lead_id", "activities" ], "additionalProperties": false } }
Additional context: I was able to do this last week on other sheets (same prompt, same volume of input)
Hey — looks like you were able to get it working? If this comes up again, the best fix is usually to regenerate the output structure. That refresh clears out any formatting issues that might be causing the Invalid Request error, especially when working with more complex JSON arrays. Let me know if it pops up again or if you want help validating the schema.
hey Bo it's doing it again, new link: https://app.clay.com/workspaces/251813/workbooks/wb_0syvmhphy6AkYGrSnX4/tables/t_0syvmhs23tUrkCcbpEe/views/gv_2Q55kofpBWKC enrichment: >getstarted
It's not giving a reason for the error so not sure how best to proceed
Vish - Sorry for this, it looks like we've got a bug on our hands. I've escalated this to our engineering team to help look into it. We'll follow up here as soon as we know more!
Thanks Bo
Hi Vish, jumping in for Bo here. We just heard back from the engineers and they weren't able to find the 'Get Started' column anymore so we have cancelled the bug for now. However, we will be on the lookout for similar error messages popping up and work on it as needed. Let us know if you face similar errors again. I'll close this for now, but please keep in touch if other questions come up. - Smit
Thanks smit, it was a production level sheet so had to delete sorry about that. can you keep the ticket open for now? I’m working on similar func today and expect to run into the same errors
Perfect, will do! Let me know if you have more questions.
hey Bo (. Smit V. got it again: https://app.clay.com/workspaces/251813/workbooks/wb_0syvmhphy6AkYGrSnX4/tables/t_0syvmhs23tUrkCcbpEe/views/gv_2Q55kofpBWKC
Column: =error
I tested a bunch of variables in =error (2) column and found that the issue is if the prompt and output json mismatch it throws this error. =error is a duplicate of the ">tooling" column, I changed the prompt but not the output json. =error (2) has both the prompt and output json updated to match. My suggestion would be to throw a specific error in this instance to notify the user that the json and prompt don't match
FYI go to Clay support view to see these columns
Hi Vish, thank you for reaching out. I've identified and resolved the issue. The error was occurring because one of the columns referenced in the prompt had been deleted. After removing that reference, everything appears to be working correctly—we were able to successfully run the first cell in the first column. I am sorry about the confusing error message!
Ah got it, thanks for your help Stefano!
Happy to help :)