Adding labels to GMail messages failing

Describe the problem/error/question

Hello friends,

New to n8n and falling in love with it, I think this may be my solution for a bunch of my “executive function” ADHD issues.

Anyhow. One thing I’m trying to do is have an agent look at my new GMail messages, and assign labels to each message from the list of user-defined labels in my account.

However, I’m encountering a generic Internal Server Error from Google when trying to add labels. But I’m not sure which message is triggering the error, or why.

What is the error message (if any)?

I’m not sure how to interpret these errors. In the output, it says “Run: 6”, “(item 0)”, and the drop-down for “Run” only says “1 of 1”. The “Input” side just says, “Error running node ‘Add Label’“.

If I select “1 of 1”, it shows one of the e-mail messages in the Input, but I’m not sure if it’s the message that triggered the error - and then the Output disappears.

Please share your workflow

Share the output returned by the last node

None.

Information on your n8n setup

  • n8n version: 2.6.4
  • Database (default: SQLite): N/A
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: Windows 11

Hello @jfc ! Ensure the following is setup correctly,

  1. Add a get all labels tool to the AI agent, so it can properly retrieve all labels, the merge node might be messing with it, and set it to Get Many Labels and Return all to True

  2. Ensure the label id’s are being passed correctly, I would get rid of the get all labels part and the merge node and use the ai tool, it would be more reliable.

1 Like

@achamm I actually just figured it out - I needed to specify to the AI agent that it can only use one label at a time with the Add Label tool. I think it was trying to add multiple labels with a single tool invocation, and the GMail API wasn’t having it.

But excellent point about using the AI agent to handle the label retrieval, that makes way more sense. Thanks for the insight!

1 Like

Your Welcome! Happy you solved it @jfc

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.