Hi does anyone know how to fix the following error?
I have built a tools agent that has supabase nodes to do basic DML operations but I got an error that the parameters are not valid.
- n8n version: n8n cloud
- Database: supabase
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via Chrome
- Operating system: Windows 11
Error:
Bad request - please check your parameters
[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-thinking-exp:streamGenerateContent?alt=sse: [400 Bad Request] Invalid JSON payload received. Unknown name “default” at ‘tools[0].function_declarations[2].parameters.properties[2].value’: Cannot find field. Invalid JSON payload received. Unknown name “default” at ‘tools[0].function_declarations[4].parameters.properties[2].value’: Cannot find field. Invalid JSON payload received. Unknown name “default” at ‘tools[0].function_declarations[7].parameters.properties[4].value’: Cannot find field. Invalid JSON payload received. Unknown name “default” at ‘tools[0].function_declarations[8].parameters.properties[1].value’: Cannot find field. [{“@type”:“type.googleapis.com/google.rpc.BadRequest",“fieldViolations”:[{“field”:“tools[0].function_declarations[2].parameters.properties[2].value”,“description”:"Invalid JSON payload received. Unknown name "default" at ‘tools[0].function_declarations[2].parameters.properties[2].value’: Cannot find field.”},{“field”:“tools[0].function_declarations[4].parameters.properties[2].value”,“description”:“Invalid JSON payload received. Unknown name "default" at ‘tools[0].function_declarations[4].parameters.properties[2].value’: Cannot find field.”},{“field”:“tools[0].function_declarations[7].parameters.properties[4].value”,“description”:“Invalid JSON payload received. Unknown name "default" at ‘tools[0].function_declarations[7].parameters.properties[4].value’: Cannot find field.”},{“field”:“tools[0].function_declarations[8].parameters.properties[1].value”,“description”:“Invalid JSON payload received. Unknown name "default" at ‘tools[0].function_declarations[8].parameters.properties[1].value’: Cannot find field.”}]}]
I’m using N8N Cloud.
This is the agent:
{
“nodes”: [
{
“parameters”: {
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.chatTrigger”,
“typeVersion”: 1.1,
“position”: [
20,
-360
],
“id”: “60e4d385-802e-42e6-8022-21e2483b5b1d”,
“name”: “When chat message received”,
“webhookId”: “6e2717cb-5af4-4e73-8005-0dad5e07dd45”
},
{
“parameters”: {
“operation”: “get”,
“tableId”: “Profiles”,
“filters”: {
“conditions”: [
{
“keyName”: “user_name”,
“keyValue”: “={{ $fromAI(‘user_name’, ‘The username to look up’, ‘string’) }}”
}
]
}
},
“type”: “n8n-nodes-base.supabaseTool”,
“typeVersion”: 1,
“position”: [
400,
-80
],
“id”: “f7a35ee9-026c-465e-95f2-e4c6d5a48fe6”,
“name”: “Get Profile”,
“credentials”: {
“supabaseApi”: {
“id”: “QNNuenry7KpHaWty”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“operation”: “update”,
“tableId”: “Profiles”,
“fieldsUi”: {
“fieldValues”: [
{
“fieldId”: “points”,
“fieldValue”: “= {{ $fromAI(‘points’, ‘The number of points to award or update’, ‘number’) }}”
},
{
“fieldId”: “last_interaction”,
“fieldValue”: “={{ $fromAI(‘last_interaction’, ‘Timestamp of the last interaction’, ‘string’, new Date().toISOString()) }}”
}
]
}
},
“type”: “n8n-nodes-base.supabaseTool”,
“typeVersion”: 1,
“position”: [
1020,
-80
],
“id”: “8343f7a1-68a2-41e3-9e82-7645517d11fd”,
“name”: “Update Profile Points”,
“credentials”: {
“supabaseApi”: {
“id”: “QNNuenry7KpHaWty”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“tableId”: “Profiles”,
“fieldsUi”: {
“fieldValues”: [
{
“fieldId”: “user_id”,
“fieldValue”: “={{ $fromAI(‘user_id’, ‘Unique identifier for the user’, ‘string’) }}”
},
{
“fieldId”: “user_name”,
“fieldValue”: “={{ $fromAI(‘user_name’, ‘Username for display’, ‘string’) }}”
},
{
“fieldId”: “first_name”,
“fieldValue”: “={{ $fromAI(‘first_name’, 'User\‘s first name’, ‘string’) }}”
},
{
“fieldId”: “last_name”,
“fieldValue”: “={{ $fromAI(‘last_name’, 'User\‘s last name’, ‘string’) }}”
},
{
“fieldId”: “points”,
“fieldValue”: “=0”
},
{
“fieldId”: “subscribed”,
“fieldValue”: “={{ $fromAI(‘subscribed’, ‘Timestamp when the user subscribed’, ‘string’, new Date().toISOString()) }}”
}
]
}
},
“type”: “n8n-nodes-base.supabaseTool”,
“typeVersion”: 1,
“position”: [
540,
-80
],
“id”: “a68a5e5c-3714-4397-8603-75faa76a515b”,
“name”: “Create Profile”,
“credentials”: {
“supabaseApi”: {
“id”: “QNNuenry7KpHaWty”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“tableId”: “Points History”,
“fieldsUi”: {
“fieldValues”: [
{
“fieldId”: “user_id”,
“fieldValue”: “={{ $fromAI(‘Field_Value’, , 'string') }}" }, { "fieldId": "points", "fieldValue": "={{ $fromAI('Field_Value',
, ‘string’) }}”
},
{
“fieldId”: “activity”,
“fieldValue”: “={{ $fromAI(‘Field_Value’, , 'string') }}" }, { "fieldId": "created_at", "fieldValue": "={{ $fromAI('Field_Value',
, ‘string’) }}”
}
]
}
},
“type”: “n8n-nodes-base.supabaseTool”,
“typeVersion”: 1,
“position”: [
700,
-80
],
“id”: “a5c57c1b-c959-49ee-b711-4fcc865a10a8”,
“name”: “Create Points Entry”,
“credentials”: {
“supabaseApi”: {
“id”: “QNNuenry7KpHaWty”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“operation”: “getAll”,
“tableId”: “Points History”,
“returnAll”: true,
“filters”: {
“conditions”: [
{
“keyName”: “user_name”,
“condition”: “eq”,
“keyValue”: “={{ $fromAI(‘user_name’, ‘Username for display’, ‘string’) }}”
}
]
}
},
“type”: “n8n-nodes-base.supabaseTool”,
“typeVersion”: 1,
“position”: [
860,
-80
],
“id”: “8a96777d-8bbf-43e7-a48b-108216f36a80”,
“name”: “Get Points History”,
“credentials”: {
“supabaseApi”: {
“id”: “QNNuenry7KpHaWty”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“tableId”: “User Activity Tracking”,
“fieldsUi”: {
“fieldValues”: [
{
“fieldId”: “user_name”,
“fieldValue”: “={{ $fromAI(‘user_id’, ‘The ID of the user’, ‘string’) }}”
},
{
“fieldId”: “activity_type”,
“fieldValue”: “={{ $fromAI(‘activity_type’, ‘Type of activity (quiz, episode, etc.)’, ‘string’) }}”
},
{
“fieldId”: “points_awarded”,
“fieldValue”: “={{ $fromAI(‘status’, ‘Current status of the activity’, ‘string’, ‘completed’) }}”
},
{
“fieldId”: “completion_date”,
“fieldValue”: “= {{ $fromAI(‘points_awarded’, ‘Points awarded for this activity’, ‘number’) }}”
}
]
}
},
“type”: “n8n-nodes-base.supabaseTool”,
“typeVersion”: 1,
“position”: [
860,
60
],
“id”: “ba80b90d-a439-4734-b144-034759d69e3d”,
“name”: “Create Activity Record”,
“credentials”: {
“supabaseApi”: {
“id”: “QNNuenry7KpHaWty”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“operation”: “getAll”,
“tableId”: “User Activity Tracking”,
“returnAll”: true,
“filters”: {
“conditions”: [
{
“keyName”: “user_name”,
“condition”: “eq”,
“keyValue”: “={{ $fromAI(‘user_name’, ‘Username for display’, ‘string’) }}”
}
]
}
},
“type”: “n8n-nodes-base.supabaseTool”,
“typeVersion”: 1,
“position”: [
420,
60
],
“id”: “1d4d56a8-50c3-49a4-a077-7b79c1751451”,
“name”: “Get All Activities”,
“credentials”: {
“supabaseApi”: {
“id”: “QNNuenry7KpHaWty”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“tableId”: “User Badges”,
“fieldsUi”: {
“fieldValues”: [
{
“fieldId”: “user_name”,
“fieldValue”: “= {{ $fromAI(‘user_name’, ‘The name ID of the user earning the badge’, ‘string’) }}”
},
{
“fieldId”: “badge_id”,
“fieldValue”: “={{ $fromAI(‘badge_id’, ‘The ID of the badge being awarded’, ‘number’) }}”
},
{
“fieldId”: “awarded_at”,
“fieldValue”: “={{ $fromAI(‘awarded_at’, ‘Timestamp when the badge was awarded’, ‘string’, new Date().toISOString()) }}”
}
]
}
},
“type”: “n8n-nodes-base.supabaseTool”,
“typeVersion”: 1,
“position”: [
580,
60
],
“id”: “ad073b88-a95c-45cf-aecf-afc825acb55f”,
“name”: “Update User Badges”,
“credentials”: {
“supabaseApi”: {
“id”: “QNNuenry7KpHaWty”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“operation”: “getAll”,
“tableId”: “User Badges”,
“returnAll”: true
},
“type”: “n8n-nodes-base.supabaseTool”,
“typeVersion”: 1,
“position”: [
720,
60
],
“id”: “bf042ec4-517d-4b78-9b4d-0a03196bea2f”,
“name”: “Get Badge Definitions”,
“credentials”: {
“supabaseApi”: {
“id”: “QNNuenry7KpHaWty”,
“name”: “Supabase account”
}
}
},
{
“parameters”: {
“options”: {
“systemMessage”: “Points Manager Agent: Supabase-Integrated Rewards System\n\nYou are the Points Manager Agent, a crucial component of the RangerHub gamified rewards system. Your primary responsibility is to calculate and award points to users based on their activities, track their progress towards earning badges, and maintain an up-to-date record in Supabase. You communicate exclusively in JSON format.\n\nYour Objective: To process requests related to user activities, calculate point awards, check for badge eligibility, and manage data within Supabase, all while providing informative JSON responses.\n\n## Data Structure in Supabase\n\nFor each user, you will maintain the following data structure in Supabase:\n\n1. User Profile (Profiles table):\n - user_id: Unique identifier for the user (primary key)\n - user_name: Username for display\n - points: Total points accumulated\n - first_name: User’s first name\n - last_name: User’s last name\n - name: Full name\n - gender: User’s gender\n - profile_pic: URL to profile picture\n - locale: User’s locale\n - language: User’s language\n - timezone: User’s timezone\n - preferred_language: User’s preferred language\n\n2. User Activity Tracking (User Activity Tracking table):\n - user_activity_id: Unique identifier for the activity record\n - user_id: ID of the user who performed the activity\n - activity_type: Type of activity (quiz, episode, poll, etc.)\n - activity_id: ID of the specific activity\n - status: Current status (completed, in_progress)\n - progress: Percentage of completion (0-100)\n - completion_date: Date when the activity was completed\n - points_awarded: Points awarded for this activity\n - created_at: When the activity record was created\n - updated_at: When the activity record was last updated\n\n3. User Badges (User Badges table):\n - user_id: ID of the user who earned the badge\n - badge_id: ID of the badge earned\n - awarded_at: Timestamp when the badge was awarded\n - created_at: When the badge record was created\n - updated_at: When the badge record was last updated\n\n## Badge Definitions\nThe following badges are available in the system:\n\nPoints-based badges:\n- Badge ID: 1, Name: "Bronze Ranger", Description: "Earn 100 points"\n- Badge ID: 2, Name: "Silver Ranger", Description: "Earn 300 points"\n- Badge ID: 3, Name: "Gold Ranger", Description: "Earn 500 points"\n- Badge ID: 6, Name: "Knowledge Explorer", Description: "Earn 100 points from educational content"\n- Badge ID: 7, Name: "Marine Biologist in Training", Description: "Complete 150 points of marine biology content"\n- Badge ID: 8, Name: "Junior Researcher", Description: "Earn 120 points from research activities"\n- Badge ID: 9, Name: "Conservation Champion", Description: "Earn 200 points from conservation activities"\n\nActivity-based badges:\n- Badge ID: 10, Name: "Quiz Master", Description: "Complete 10 quizzes"\n- Badge ID: 11, Name: "Trivia Genius", Description: "Get 15 correct answers in a row"\n- Badge ID: 12, Name: "Fast Learner", Description: "Complete a quiz in under 2 minutes"\n- Badge ID: 13, Name: "Community Helper", Description: "Participate in 5 community activities"\n- Badge ID: 14, Name: "First Step", Description: "Complete your first activity"\n- Badge ID: 15, Name: "Referral Champion", Description: "Refer 5 friends to RangerHub"\n- Badge ID: 16, Name: "Earth Day Advocate", Description: "Participate in Earth Day activities"\n- Badge ID: 17, Name: "Special Guest", Description: "Attend a special event"\n- Badge ID: 18, Name: "Profile Builder", Description: "Complete your profile information"\n\n## Request Processing\n\nReceiving a Request: You will receive a JSON request containing an action field, user_name, and other relevant information. The action field specifies what operation to perform.\n\nExample Request Format:\n{\n "action": "award_points",\n "user_name": "Denver_Elias",\n "activity_type": "episode",\n "completion_date": "2025-01-20T15:30:45Z"\n}\n\nSupported Actions:\n1. "award_points" - Award points to a user for completing an activity\n2. "get_profile" - Retrieve a user’s profile information\n3. "check_badge_eligibility" - Check if a user is eligible for any badges\n4. "get_leaderboard" - Get the points leaderboard\n5. "create_account" - Create a new user account\n\nProcess the Request: Use the following steps to process the request based on the action:\n\nFor "award_points" action:\na) Calculate Points: Determine the number of points awarded for the activity based on these rules:\n- quiz: 10 points\n- challenge: 20 points\n- episode: 15 points\n- poll: 5 points\n- story: 10 points\n- event: 25 points\n- submission: 15 points\n- leaderboard_achievement: 50 points\n- referral: 30 points\n- daily_check_in: 5 points\n\nb) Get User Profile: Query the Profiles table to get the user’s current information including points.\n\nc) Update User Points: Add the newly awarded points to the user’s total and update their profile.\n\nd) Record Activity: Create a new record in the User Activity Tracking table with all relevant details.\n\ne) Check Badge Eligibility: Determine if the user has earned any new badges based on their updated points total and activity history. First, check which badges the user already has by querying the User Badges table. Then, check if they’re eligible for any new badges based on the badge definitions above.\n\nWhen a user earns a new badge:\n1. Check the User Badges table to ensure they don’t already have this badge\n2. Create a new record in the User Badges table with:\n - user_id: The user’s ID\n - badge_id: The ID of the earned badge\n - awarded_at: Current timestamp\n - created_at: Current timestamp\n - updated_at: Current timestamp\n\nf) Formulate Response: Send a structured JSON response.\n\nFor "get_profile" action:\na) Query the Profiles table to get the user’s information\nb) Query the User Badges table to get the user’s badges\nc) Return the combined information in a structured response\n\nFor "check_badge_eligibility" action:\na) Get the user’s current points and activity history\nb) Check which badges they already have\nc) Determine if they’re eligible for any new badges\nd) Return a list of eligible badges\n\nFor "get_leaderboard" action:\na) Query the Profiles table to get users sorted by points\nb) Limit the results based on the request (default: 10)\nc) Return the leaderboard in a structured response\n\nFor "create_account" action:\na) Extract user data from the request\nb) Validate the required fields (user_id, user_name, first_name, last_name)\nc) Format the data according to the Profiles table structure\nd) Create a new record in the Profiles table\ne) Respond with a success or error message\n\n## Account Creation\nFor the "create_account" action, the request should have this format:\n\n{\n "action": "create_account",\n "user_data": {\n "user_id": "1234567890123456",\n "user_name": "New_User_123",\n "first_name": "John",\n "last_name": "Doe",\n "gender": "male",\n "profile_pic": "https://example.com/profile.jpg\”,\n "locale": "en_US",\n "language": "English",\n "timezone": "UTC-04",\n "preferred_language": "English"\n }\n}\n\nProcess Account Creation:\n1. Extract user data from the request\n2. Validate the required fields (user_id, user_name, first_name, last_name)\n3. Format the data according to the Profiles table structure:\n - Set full name by combining first_name and last_name if not provided\n - Initialize points to 0\n - Set default values for any missing optional fields\n4. Create a new record in the Profiles table with the formatted data\n5. Respond with a success or error message\n\n## Response Formats\nYour response should include the following:\n\nFor "award_points" action:\n- status: "success" or "error"\n- message: A brief, informative message about the outcome\n- user_name: The user_name from the original request\n- points_awarded: The number of points awarded (0 if an error occurred)\n- badge_unlocked: The name of the badge if one was unlocked, null if no badge was unlocked\n- total_points: The user’s updated total points\n\nExample Responses:\n\nSuccessful Points Award (No Badge):\n{\n "status": "success",\n "message": "Awarded 10 points to Denver_Elias for completing a quiz.",\n "user_name": "Denver_Elias",\n "points_awarded": 10,\n "badge_unlocked": null,\n "total_points": 100\n}\n\nSuccessful Points Award and Badge Unlock:\n{\n "status": "success",\n "message": "Awarded 10 points to Denver_Elias. Unlocked Quiz Master Badge!",\n "user_name": "Denver_Elias",\n "points_awarded": 10,\n "badge_unlocked": "Quiz Master",\n "total_points": 110\n}\n\nFor "get_profile" action:\n{\n "status": "success",\n "user_name": "Denver_Elias",\n "profile": {\n "user_id": "8941111542590917",\n "points": 125,\n "first_name": "Denver",\n "last_name": "Elias",\n "name": "Denver Gabriel Elias",\n "gender": "male",\n "preferred_language": "Papiamentu"\n },\n "badges": [\n {\n "badge_id": 1,\n "badge_name": "Bronze Ranger",\n "awarded_at": "2025-01-15T08:30:00Z"\n }\n ]\n}\n\nFor "create_account" action:\n{\n "status": "success",\n "message": "Account created successfully for New_User_123",\n "user_id": "1234567890123456",\n "user_name": "New_User_123",\n "points": 0\n}\n\nError Handling:\n{\n "status": "error",\n "message": "Failed to calculate points for unknown activity type.",\n "user_name": "Denver_Elias",\n "points_awarded": 0,\n "error_details": "Activity type ‘unknown_activity’ not recognized",\n "retry_recommended": false\n}\n\nAccount Creation Error:\n{\n "status": "error",\n "message": "Failed to create account",\n "error_details": "User with user_name ‘New_User_123’ already exists",\n "retry_recommended": false\n}\n\n## Important Considerations\n1. JSON Format: Always ensure that your responses are valid JSON.\n2. Error Handling: Implement robust error handling. If a process fails, catch the error and formulate an appropriate error response.\n3. Badge Checking: Check both points-based and activity-based badge eligibility after each activity.\n4. Activity Counting: Keep track of activity counts by category (quizzes, challenges, stories, etc.) to properly evaluate badge eligibility.\n5. Points History: Maintain a record of points transactions with reasons and timestamps.\n6. Account Creation: Validate all required fields before creating a new account and check if the user already exists to avoid duplicates.\n7. Data Consistency: Ensure that all data is properly formatted and validated before storing in Supabase.\n8. Activity Details: Store all relevant activity details in the User Activity Tracking table for future reference and badge eligibility checking."
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.7,
“position”: [
200,
-360
],
“id”: “fd9188ad-2b71-44de-976a-d6ca7d96d029”,
“name”: “AI Agent”
},
{
“parameters”: {
“modelName”: “models/gemini-2.0-flash-thinking-exp”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatGoogleGemini”,
“typeVersion”: 1,
“position”: [
80,
-100
],
“id”: “d3f0200e-44d7-4600-8dc7-6d833844b590”,
“name”: “Google Gemini Chat Model”,
“credentials”: {
“googlePalmApi”: {
“id”: “JwaI5W5zPqhYdYGV”,
“name”: “Google Gemini(PaLM) Api account 2”
}
}
},
{
“parameters”: {
“operation”: “getAll”,
“tableId”: “User Badges”,
“returnAll”: true,
“filters”: {
“conditions”: [
{
“keyName”: “user_name”,
“condition”: “eq”,
“keyValue”: “{{ $fromAI(‘user_name’, ‘The name ID of the user to get badges for’, ‘string’) }}”
}
]
}
},
“type”: “n8n-nodes-base.supabaseTool”,
“typeVersion”: 1,
“position”: [
1020,
80
],
“id”: “b93378ce-de72-4345-914c-92c3cc3a7e87”,
“name”: “Get User Badges”,
“credentials”: {
“supabaseApi”: {
“id”: “QNNuenry7KpHaWty”,
“name”: “Supabase account”
}
}
}
],
“connections”: {
“When chat message received”: {
“main”: [
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“Get Profile”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Update Profile Points”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Create Profile”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Create Points Entry”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Get Points History”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Create Activity Record”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Get All Activities”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Update User Badges”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Get Badge Definitions”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“AI Agent”: {
“main”: [
]
},
“Google Gemini Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Get User Badges”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “4f82f2e3e20b15c106540d339b02da079d3fba11ed871ce3cdf49ff2ea480575”
}
}