Google Calendar - Get List, always errors

Describe the problem/error/question

I am have intermittent issues with my AI Agent using the Google Calendar tool to respond to a request like “What events do I have this week”.

This is how I have my tool setup:

What is the error message (if any)?

It seems ‘Start’ is an issue?

"message": "Bad request - please check your parameters", "timestamp": 1748085150470, "name": "NodeApiError", "description": "Invalid field selection start", "context": {}, "cause": { "message": "400 - {\"error\":{\"errors\":[{\"domain\":\"global\",\"reason\":\"invalidParameter\",\"message\":\"Invalid field selection start\",\"locationType\":\"parameter\",\"location\":\"fields\"}],\"code\":400,\"message\":\"Invalid field selection start\"}}"

Please share your workflow

{
  "nodes": [
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Get a list of calendar events",
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "value": "craig@-------,
          "mode": "list",
          "cachedResultName": "The Listers"
        },
        "returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}",
        "timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('After', ``, 'string') }}",
        "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', ``, 'string') }}",
        "options": {
          "fields": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Fields', ``, 'string') }}"
        }
      },
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.3,
      "position": [
        400,
        300
      ],
      "id": "5f9807c8-b327-42f6-9112-93fb45e94ec3",
      "name": "Get Calendar Events",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "HNcNEWWasasaBLPCrl",
          "name": "Google Calendar account"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Telegram Trigger').item.json.message.text }}",
        "options": {
          "systemMessage": "=The current date and time is {{ $now }}\n\nYou are a friendly, funny and sometimes sarcastic assistant. When you respond, you reply with messages no longer than 60 words.\n\nYou have access to Google Sheets to get Contact information for certain people with first names, surnames, and emails. \n\nYou also have access to a list of devices in the house, such as lights and temperature sensors. When ever you get a request, make sure you get thr latest information from these sheets. You will always use the entity_id when interacting with home assistant nodes.\n\nDon't cache this data."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        20,
        -300
      ],
      "id": "451cb3f8-d952-47fa-bd36-5c1709dc979c",
      "name": "Handle Discussions and Requests"
    }
  ],
  "connections": {
    "Get Calendar Events": {
      "ai_tool": [
        [
          {
            "node": "Handle Discussions and Requests",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Handle Discussions and Requests": {
      "main": [
        []
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "a9bf52dc61a4a541708f42ef316041c655ec6acf79b92ce7ea1f05256ce2dc7c"
  }
}

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.93.0 (Run in Docker)
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Docker on Windows 11

I don’t know what is the image of your first Google Calendar for, but if you are checking (such as your second image rightfully shows), then the “operation” section should be “Get Many” and not “create”. Please note that Google Calendar has a known bug on checking events, the best approach is to get a list “BusyFree” list (more info: see api, do a chatGPT), you might need to ask AI-Agent to sort it if it is under a Agent or use a sort node (if it is not). Also I suggest to set the “After” and “Before” by code and not using LLM, LLM sometimes makes alot of pain. This might be helpful:
After (from 12 hours before now):

{{ new Date(new Date($fromAI(“startTime”)).getTime() - 12 * 60 * 60 * 1000).toISOString() }}

Before (next 7 days):

{{ new Date(new Date($fromAI(“startTime”)).setDate(new Date($fromAI(“startTime”)).getDate() + 7)).toISOString() }}

1 Like

Thank you. Let me try this. As for the “create” issue, that’s an error by me. Maybe I changed it by mistake. But was using GetMany.

Thanks. I am no longer getting an error. So it seems I need to build a node for “Next 7 days”, and a node for “Tomorrow”? So now+7 days, and a now+1 day?

It now no longer returns an error. Awesome. But I think my fields are wrong as it says:

“No parameters are set up to be filled by AI. Click on the :sparkles: button next to a parameter to allow AI to set its value.”

Looks like I just need to work out the fields thing?

If you’re using AI-Agent, you can make 2 nodes: tomorrow and 1 week, and in AI-Agent message choose the one that you like; Otherwise an if or select node would possibly do the job

1 Like