# IllegalArgumentException\[no account found for name: \[null\]\]

**URL:** <https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [August 29, 2017, 9:32am UTC](https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659 "2017-08-29T09:32:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gautamv](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@gautamv](https://discuss.elastic.co/u/gautamv)\
**Post date:** [August 29, 2017, 9:32am UTC](https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659/1 "2017-08-29T09:32:57Z")

</div>

Hi,

I configured watcher to get alerts for a particular error message. Here is my watcher code:

```
{
  "trigger": {
    "schedule": {
      "interval": "1m"
    }
  },
  "input": {
    "search": {
      "request": {
        "search_type": "query_then_fetch",
        "indices": [
          "prod_log-*"
        ],
        "types": [],
        "body": {
          "size": 0,
          "query": {
            "bool": {
              "must": [
                {
                  "match": {
                    "type": "SystemError"
                  }
                },
                {
                  "match_phrase": {
                    "message": "A remote host refused an attempted connect operation."
                  }
                },
                {
                  "range": {
                    "@timestamp": {
                      "gte": "now-10000m",
                      "lte": "now"
                    }
                  }
                }
              ]
            }
          }
        }
      }
    }
  },
  "condition": {
    "compare": {
      "ctx.payload.hits.total": {
        "gte": 10
      }
    }
  },
  "actions": {
    "my-logging-action": {
      "logging": {
        "level": "info",
        "text": "There are {{ctx.payload.hits.total}} documents in your index. Threshold is 10. The alert was detected at {{ctx.execution_time}}"
      }
    },
    "send_email": {
      "email": {
        "to": "xxxx@gmail.com",
        "subject": "Watcher Notification",
        "body": "There are {{ctx.payload.hits.total}} documents in your index. Threshold is 10. The alert was detected at {{ctx.execution_time}}"
      }
    }
  }
}

```

When I run the watcher, I'm getting the following error:  
`IllegalArgumentException[no account found for name: [null]]`

Additonally, I'm also noticing something weird, when I save the above watcher code, and I open it again it automatically chages part of the code to this:

```
  "actions": {
    "send_email": {
      "email": {
        "profile": "standard",
        "to": [
          "xxxx@gmail.com"
        ],
        "subject": "Watcher Notification",
        "body": {
          "text": "There are {{ctx.payload.hits.total}} documents in your index. Threshold is 10. The alert was detected at {{ctx.execution_time}}"
        }
      }
    }
  }

```

Is this causing the error?

Please also find below the elasticsearch.yml configuration:

```
xpack.notification.email.account:
        gmail_account:
                profile: gmail
                smtp:
                        auth: true
                        starttls.enable: true
                        host: smtp.gmail.com
                        port: 587
                        user: xxxxx@gmail.com
                        password: xxxxxxxx

```

Please help.

Thanks

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 29, 2017, 10:25am UTC](https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659/2 "2017-08-29T10:25:22Z")

</div>

hey

how many nodes do you have? have you configured the email settings on all of your nodes? Which Elasticsearch version is this?

--Alex

---

<div class="post-metadata">

**Author:** ![gautamv](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@gautamv](https://discuss.elastic.co/u/gautamv)\
**Post date:** [August 29, 2017, 10:31am UTC](https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659/3 "2017-08-29T10:31:13Z")

</div>

Hi,

I'm currently running only one node for testing purposes. My elasticsearch version is 5.5.2.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 29, 2017, 12:23pm UTC](https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659/4 "2017-08-29T12:23:54Z")

</div>

can you share the output of `GET _nodes` (note, please redact anything like IP addresses or whatever you deem necessary before pasting it here)

---

<div class="post-metadata">

**Author:** ![gautamv](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@gautamv](https://discuss.elastic.co/u/gautamv)\
**Post date:** [August 30, 2017, 6:12am UTC](https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659/5 "2017-08-30T06:12:56Z")

</div>

Hi,

Please find below the output of `GET _nodes` as requested.

```
{
  "_nodes": {
    "total": 1,
    "successful": 1,
    "failed": 0
  },
  "cluster_name": "elasticsearch",
  "nodes": {
    "mAAmcM7dSEm_CUbVi3Bn1g": {
      "name": "mAAmcM7",
      "transport_address": "x.x.x.x:9300",
      "host": "x.x.x.x",
      "ip": "x.x.x.x",
      "version": "5.5.2",
      "build_hash": "b2f0c09",
      "total_indexing_buffer": 213005107,
      "roles": [
        "master",
        "data",
        "ingest"
      ],
      "attributes": {
        "ml.max_open_jobs": "10",
        "ml.enabled": "true"
      },
      "settings": {
        "pidfile": "/var/run/elasticsearch/elasticsearch.pid",
        "cluster": {
          "name": "elasticsearch"
        },
        "node": {
          "attr": {
            "ml": {
              "max_open_jobs": "10",
              "enabled": "true"
            }
          },
          "name": "mAAmcM7"
        },
        "path": {
          "logs": "/var/log/elasticsearch",
          "home": "/usr/share/elasticsearch"
        },
        "default": {
          "path": {
            "data": "/var/lib/elasticsearch",
            "logs": "/var/log/elasticsearch",
            "conf": "/etc/elasticsearch"
          }
        },
        "client": {
          "type": "node"
        },
        "http": {
          "type": "security4",
          "port": "9200"
        },
        "transport": {
          "type": "security4"
        },
        "network": {
          "host": "0.0.0.0"
        }
      },
      "os": {
        "refresh_interval_in_millis": 1000,
        "name": "Linux",
        "arch": "amd64",
        "version": "4.9.32-15.41.amzn1.x86_64",
        "available_processors": 2,
        "allocated_processors": 2
      },
      "process": {
        "refresh_interval_in_millis": 1000,
        "id": 19394,
        "mlockall": false
      },
      "jvm": {
        "pid": 19394,
        "version": "1.8.0_131",
        "vm_name": "Java HotSpot(TM) 64-Bit Server VM",
        "vm_version": "25.131-b11",
        "vm_vendor": "Oracle Corporation",
        "start_time_in_millis": 1503921557268,
        "mem": {
          "heap_init_in_bytes": 2147483648,
          "heap_max_in_bytes": 2130051072,
          "non_heap_init_in_bytes": 2555904,
          "non_heap_max_in_bytes": 0,
          "direct_max_in_bytes": 2130051072
        },
        "gc_collectors": [
          "ParNew",
          "ConcurrentMarkSweep"
        ],
        "memory_pools": [
          "Code Cache",
          "Metaspace",
          "Compressed Class Space",
          "Par Eden Space",
          "Par Survivor Space",
          "CMS Old Gen"
        ],
        "using_compressed_ordinary_object_pointers": "true",
        "input_arguments": [
          "-Xms2g",
          "-Xmx2g",
          "-XX:+UseConcMarkSweepGC",
          "-XX:CMSInitiatingOccupancyFraction=75",
          "-XX:+UseCMSInitiatingOccupancyOnly",
          "-XX:+AlwaysPreTouch",
          "-Xss1m",
          "-Djava.awt.headless=true",
          "-Dfile.encoding=UTF-8",
          "-Djna.nosys=true",
          "-Djdk.io.permissionsUseCanonicalPath=true",
          "-Dio.netty.noUnsafe=true",
          "-Dio.netty.noKeySetOptimization=true",
          "-Dio.netty.recycler.maxCapacityPerThread=0",
          "-Dlog4j.shutdownHookEnabled=false",
          "-Dlog4j2.disable.jmx=true",
          "-Dlog4j.skipJansi=true",
          "-XX:+HeapDumpOnOutOfMemoryError",
          "-Des.path.home=/usr/share/elasticsearch"
        ]
      },
      "thread_pool": {
        "watcher": {
          "type": "fixed",
          "min": 10,
          "max": 10,
          "queue_size": 1000
        },
        "force_merge": {
          "type": "fixed",
          "min": 1,
          "max": 1,
          "queue_size": -1
        },
        "security-token-key": {
          "type": "fixed",
          "min": 1,
          "max": 1,
          "queue_size": 1000
        },
```

---

<div class="post-metadata">

**Author:** ![gautamv](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@gautamv](https://discuss.elastic.co/u/gautamv)\
**Post date:** [August 30, 2017, 6:14am UTC](https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659/6 "2017-08-30T06:14:35Z")

</div>

```
    "ml_datafeed": {
      "type": "fixed",
      "min": 10,
      "max": 10,
      "queue_size": 200
    },
    "fetch_shard_started": {
      "type": "scaling",
      "min": 1,
      "max": 4,
      "keep_alive": "5m",
      "queue_size": -1
    },
    "listener": {
      "type": "fixed",
      "min": 1,
      "max": 1,
      "queue_size": -1
    },
    "ml_autodetect": {
      "type": "fixed",
      "min": 40,
      "max": 40,
      "queue_size": 4
    },
    "index": {
      "type": "fixed",
      "min": 2,
      "max": 2,
      "queue_size": 200
    },
    "refresh": {
      "type": "scaling",
      "min": 1,
      "max": 1,
      "keep_alive": "5m",
      "queue_size": -1
    },
    "generic": {
      "type": "scaling",
      "min": 4,
      "max": 128,
      "keep_alive": "30s",
      "queue_size": -1
    },
    "warmer": {
      "type": "scaling",
      "min": 1,
      "max": 1,
      "keep_alive": "5m",
      "queue_size": -1
    },
    "search": {
      "type": "fixed",
      "min": 4,
      "max": 4,
      "queue_size": 1000
    },
    "flush": {
      "type": "scaling",
      "min": 1,
      "max": 1,
      "keep_alive": "5m",
      "queue_size": -1
    },
    "fetch_shard_store": {
      "type": "scaling",
      "min": 1,
      "max": 4,
      "keep_alive": "5m",
      "queue_size": -1
    },
    "management": {
      "type": "scaling",
      "min": 1,
      "max": 5,
      "keep_alive": "5m",
      "queue_size": -1
    },
    "ml_utility": {
      "type": "fixed",
      "min": 40,
      "max": 40,
      "queue_size": 500
    },
    "get": {
      "type": "fixed",
      "min": 2,
      "max": 2,
      "queue_size": 1000
    },
    "bulk": {
      "type": "fixed",
      "min": 2,
      "max": 2,
      "queue_size": 200
    },
    "snapshot": {
      "type": "scaling",
      "min": 1,
      "max": 1,
      "keep_alive": "5m",
      "queue_size": -1
    }
  },
  "transport": {
    "bound_address": [
      "[::]:9300"
    ],
    "publish_address": "x.x.x.x:9300",
    "profiles": {}
  },
  "http": {
    "bound_address": [
      "[::]:9200"
    ],
    "publish_address": "x.x.x.x:9200",
    "max_content_length_in_bytes": 104857600
  },
  "plugins": [
    {
      "name": "x-pack",
      "version": "5.5.2",
      "description": "Elasticsearch Expanded Pack Plugin",
      "classname": "org.elasticsearch.xpack.XPackPlugin",
      "has_native_controller": true
    }
  ],
```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 30, 2017, 7:45am UTC](https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659/7 "2017-08-30T07:45:51Z")

</div>

The `settings` part of your JSON response does **not** contain any of your `xpack.notification.email` settings, so the setting was not applied. Did you restart your node after changing the file?

If you did, can you share your complete configuration file (do not paste it somewhere, but really put the exact file somewhere one can download it, I want to check if your maybe have any indentation errors).

Sample output from my test setup

```auto
curl 'localhost:9200/_nodes?pretty&filter_path=**.settings.xpack.notification'
{
  "nodes" : {
    "_Awjmxm5SXSraqf9uQOFhg" : {
      "settings" : {
        "xpack" : {
          "notification" : {
            "email" : {
              "account" : {
                "foo" : {
                  "smtp" : {
                    "host" : "localhost",
                    "starttls" : {
                      "enable" : "true"
                    },
                    "auth" : "true",
                    "port" : "1025"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

```

with this configuration

```auto
xpack.notification.email.account:
  foo:
    smtp:
      auth: true
      starttls.enable: true
      host: localhost
      port: 1025

```

---

<div class="post-metadata">

**Author:** ![gautamv](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@gautamv](https://discuss.elastic.co/u/gautamv)\
**Post date:** [August 31, 2017, 6:25am UTC](https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659/8 "2017-08-31T06:25:11Z")

</div>

Hi,

I restarted the node and it worked now.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 28, 2017, 6:25am UTC](https://discuss.elastic.co/t/illegalargumentexception-no-account-found-for-name-null/98659/9 "2017-09-28T06:25:51Z")

</div>

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