Help with error workflow

Hi, I have this error workflow configured. Its getting triggered successfully when one of my workflow fails, but the email text expression is not getting evaluated
ie, i am expecting {{$node[“Error Trigger”].json[“workflow”][“id”]}} to be translated as my failed workflow id but it doesn’t evaluate at all
Am I doing anything wrong here?

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "fromEmail": "[email protected]",
        "toEmail": "[email protected]",
        "subject": "workflow with name: {{$node[\"Error Trigger\"].json[\"workflow\"][\"name\"]}} failed to execute",
        "text": **"*Your workflow with ID: {{$node[\"Error Trigger\"].json[\"workflow\"][\"id\"]}} and name: {{$node[\"Error Trigger\"].json[\"workflow\"][\"name\"]}} failed to execute",***
        "options": {
          "allowUnauthorizedCerts": false
        }
      },

Hi @skanayi, welcome to the forum!

I’m sorry to hear you’re having trouble. The expression itself is looking good to me (assuming the fancy double quotes are result of copy pasting over your JSON and your actual quotes used in your expression look like this Your workflow with ID: {{$node["Error Trigger"].json["workflow"]["id"]}} and name: {{$node["Error Trigger"].json["workflow"]["name"]}} failed to execute.

Would you be able to share your full error workflow (removing anything confidential, of course)?

In addition, you might want to store and look at the error workflow’s execution data - this might give us an additional indicator of what’s wrong. You can configure this through the workflow settings described at Workflow | Docs.

1 Like

Thanks a lot for the quick response @MutedJam
Below are the gists for that

Workflow 1 : workflow · GitHub
Error workflow: error workflow · GitHub
Error execution data: error execution data · GitHub

Cheers @skanayi, I’ll take a look into this and will get back to you as soon as I can!

Hi @skanayi, it looks like your expression was entered as plain text. In order for the expression to be understood, you’d need to spcifically add it as an expression via the little cog next to the text field:

image

The error workflow data would then look like so:

The resulting emails then show the expected text (old vs. new):

I hope this makes sense and helps! Let me know if you’re still facing any issues after updating your error flow.

2 Likes

Thanks for this
I missed the trick,completely.
Thanks for the quick help on this.Another reason to like n8n :slight_smile:

1 Like