Could not parse action for watch id contains whitespace – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-7.15

Briefly, this error occurs when the ID field in the Elasticsearch watch contains whitespace, which is not allowed. The watch is a feature that performs actions based on condition fulfillment. To resolve this issue, you should ensure that the ID field does not contain any whitespace. You can do this by either removing the whitespace manually or by implementing a validation check in your application to prevent whitespace in the ID field. Additionally, ensure that the action field is correctly formatted and can be parsed by Elasticsearch.

This guide will help you check for common problems that cause the log ” could not parse action [{}] for watch [{}]. id contains whitespace ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “could not parse action [{}] for watch [{}]. id contains whitespace” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 XContentParser.Token token;
 while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
 if (token == XContentParser.Token.FIELD_NAME) {
 id = parser.currentName();
 if (WatcherUtils.isValidId(id) == false) {
 throw new ElasticsearchParseException("could not parse action [{}] for watch [{}]. id contains whitespace"; id;
 } else if (token == XContentParser.Token.START_OBJECT && id != null) {
 actions.add(ActionWrapper.parse(watchId; id; parser; this; clock; licenseState));


How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?