Expected starting JSON object after in watch – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when Elasticsearch expects a JSON object at the start of a watch definition, but it doesn’t find one. This could be due to a syntax error or incorrect formatting in the watch JSON. To resolve this issue, you should review the watch definition and ensure it starts with a JSON object. Also, validate the JSON syntax to ensure there are no errors. If the problem persists, consider recreating the watch with the correct JSON structure.

This guide will help you check for common problems that cause the log ” Expected starting JSON object after [{}] in watch [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “Expected starting JSON object after [{}] in watch [{}]” class name is ChainInput.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 }  private static Input parseSingleInput(String watchId; String name; XContentParser parser; InputRegistry inputRegistry)
 throws IOException {
 if (parser.nextToken() != XContentParser.Token.START_OBJECT) {
 throw new ElasticsearchParseException("Expected starting JSON object after [{}] in watch [{}]"; name; watchId);
 }  Input input = inputRegistry.parse(watchId; parser).input();  // expecting closing of two json object to start the next element in the array