Skip to content
Encountering an err...
 
Notifications
Clear all

Encountering an error with webhooks and simple memory

6 Posts
5 Users
0 Reactions
6 Views
Sathish
(@sathish)
Posts: 2
New Member
Topic starter
 

Bad request - kindly verify your parameters.

I'm encountering an error whenever I use simple memory.

 
Posted : 20/04/2025 11:03 am
slim-python
(@slim-python)
Posts: 6
Active Member
 

Which Gemini model are you utilizing? Could you share the JSON file if it's feasible?

 
Posted : 20/04/2025 11:34 am
Sathish
(@sathish)
Posts: 2
New Member
Topic starter
 

Hi ,

The JSON represents the data used in simple memory.

```json
[
{
"action": "loadMemoryVariables",
"chatHistory": [
{
"lc": 1,
"type": "constructor",
"id": [
"langchaincore",
"messages",
"HumanMessage"
],
"kwargs": {
"available
data": [
"-Some pre defined data)"
],
"userinput": "hi",
"additional
kwargs": {},
"responsemetadata": {}
}
},
{
"lc": 1,
"type": "constructor",
"id": [
"langchain
core",
"messages",
"AIMessage"
],
"kwargs": {
"content": "Hi Sathish! How can I assist you today?

:blush:

",
"toolcalls": null,
"invalid
toolcalls": null,
"additional
kwargs": {},
"response_metadata": {}
}
}
]
}
]
```

I'm encountering an issue specifically when using simple memory.

Gemini JSON:

```json
{
"messages": [
"System: You are Sathish’s personal AI assistant ‘JARVIS’.nnnYou can see and use AvailableData, which contains user-specific information.nWhen the user sends a UserInput, reply based on general knowledge or by using AvailableData if it’s relevant.nIf AvailableData is missing but the question can still be answered from general knowledge, go ahead and answer it.nOnly say you don’t have enough information if both general knowledge and Available_Data can’t help.nn​:brain: Example Behaviors:nUser Input: "Tell me a joke" →

:white_check_mark:
AI responds with a joke.nnUser Input: "What are calories?" →

:white_check_mark:
AI explains what calories are.nnUser Input: "What’s my BMI?"nnIf Available_Data includes height and weight →

:white_check_mark:
AI calculates BMI.nnIf not →

:x:
AI should not say "I don’t have any information" generally — it should say "To calculate your BMI, I need your height and weight."nnnHuman: undefinednAI: Hi Sathish! How can I assist you today?

:blush:
nHuman: {"UserInput":"hi"}"
],
"estimatedTokens": 213,
"options": {
"google
apikey": {
"lc": 1,
"type": "secret",
"id": [
"GOOGLE
APIKEY"
]
},
"base
url": " https://generativelanguage.googleapis.com ",
"model_name": "gemini-1.5-flash"
}
}
```

Error:

json
{
"errorMessage": "Bad request - please check your parameters",
"errorDescription": "[GoogleGenerativeAI Error]: Error fetching from <a href="https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:streamGenerateContent?alt=sse:" rel="noopener nofollow ugc"> https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:streamGenerateContent?alt=sse:</a> [400 Bad Request] * GenerateContentRequest.contents[0].parts: contents.parts must not be empty.n",
"errorDetails": {},
"n8nDetails": {
"time": "4/20/2025, 5:21:08 PM",
"n8nVersion": "1.88.0 (Self Hosted)",
"binaryDataMode": "default",
"cause": {
"status": 400,
"statusText": "Bad Request",
"attemptNumber": 1,
"retriesLeft": 6
}
}
}

 
Posted : 20/04/2025 11:58 am
mohamed3nan
(@mohamed3nan)
Posts: 18
Active Member
 

Hi,

Are you certain you are sending data to the AI agent? Specifically, how are you processing the information received from the Webhook?

 
Posted : 20/04/2025 1:29 pm
StorMand
(@stormand)
Posts: 1
New Member
 

I'm also facing this issue and attempting to utilize the Redis Chat Memory. It appears that the content isn't being properly sanitized for JSON when entering or exiting the memory modules.

My suspicion is that this might be specific to the Google API (a common element in my setup), and it's returning unsafe, unescaped results. When a problematic entry is stored in the cache, it corrupts all subsequent transactions because it gets included in the context.

OP, in one of your examples, the JSON is corrupted due to strange characters in tool_calls and invalid_tool_calls.

(NOTE: When posting code like this, please ensure it's formatted using the preformatted text option, similar to the following – I had to correct your fancy quotes to straight quotes before validating the format with an online JSON validator.)

The issue in your second example is the following line, which requires escaped quotes like this:


            "System: You are Sathish’s personal AI assistant ‘JARVIS’.


You can see and use Available_Data, which contains user-specific information.
When the user sends a User_Input, reply based on general knowledge or by using Available_Data if it’s relevant.
If Available_Data is missing but the question can still be answered from general knowledge, go ahead and answer it.
Only say you don’t have enough information if both general knowledge and Available_Data can’t help.

​:brain: Example Behaviors:
User Input: "Tell me a joke" → :white_check_mark: AI responds with a joke.

User Input: "What are calories?" → :white_check_mark: AI explains what calories are.

User Input: "What’s my BMI?"

If Available_Data includes height and weight → :white_check_mark: AI calculates BMI.

If not → :x: AI should not say "I don’t have any information" generally — it should say "To calculate your BMI, I need your height and weight."


Human: undefined
AI: Hi Sathish! How can I assist you today? :blush:
Human: {"User_Input":"hi"}"

I'm somewhat stuck trying to resolve this. I believe the best approach is to sanitize the content before it enters the cache, but this isn't happening. Should this be occurring, or can we implement it? PERHAPS the solution lies in explicitly instructing the generation of only safe, escaped answers?

 
Posted : 25/04/2025 1:12 pm
system
(@system)
Posts: 332
Reputable Member
 

This thread was automatically closed 90 days following the last response. New replies are no longer permitted.

 
Posted : 24/07/2025 1:13 pm
Share: