# ES 2.2: Plugin with \_search endpoint not loading in embedded node due to "AssertionError"

**URL:** <https://discuss.elastic.co/t/es-2-2-plugin-with--search-endpoint-not-loading-in-embedded-node-due-to-assertionerror/41610>\
**Category:** Elasticsearch\
**Created:** [February 12, 2016, 12:58pm UTC](https://discuss.elastic.co/t/es-2-2-plugin-with--search-endpoint-not-loading-in-embedded-node-due-to-assertionerror/41610 "2016-02-12T12:58:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shreyasbr](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@shreyasbr](https://discuss.elastic.co/u/shreyasbr)\
**Post date:** [February 12, 2016, 12:58pm UTC](https://discuss.elastic.co/t/es-2-2-plugin-with--search-endpoint-not-loading-in-embedded-node-due-to-assertionerror/41610/1 "2016-02-12T12:58:10Z")

</div>

I'm using Elasticsearch v2.2.0  
I have a plugin which uses the existing "\_search" endpoint. That is, I register the following handlers for my plugin:

1. /\_search
2. /{index}/\_search
3. /{index}/{type}/\_search

The plugin works fine when installed on the standalone cluster. However, when I load it onto a test class extending **ESIntegTestCase** using:

`@Override
    protected Collection<Class<? extends Plugin>> nodePlugins() {
        return pluginList(MyPlugin.class);
    }
`

and start a test, I get the following error:

[code]org.elasticsearch.common.inject.CreationException: Guice creation errors:

1. Error injecting constructor, java.lang.AssertionError  
at org.elasticsearch.rest.action.search.RestSearchAction.(Unknown Source)  
while locating org.elasticsearch.rest.action.search.RestSearchAction  
1 error  
at org.elasticsearch.common.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:360)  
at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:178)  
at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:110)  
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)  
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)  
at org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:46)  
at org.elasticsearch.node.Node.(Node.java:200)  
at org.elasticsearch.node.MockNode.(MockNode.java:43)  
at org.elasticsearch.test.InternalTestCluster.buildNode(InternalTestCluster.java:606)  
at org.elasticsearch.test.InternalTestCluster.reset(InternalTestCluster.java:957)  
at org.elasticsearch.test.InternalTestCluster.beforeTest(InternalTestCluster.java:925)  
at org.elasticsearch.test.ESIntegTestCase.beforeInternal(ESIntegTestCase.java:345)  
at org.elasticsearch.test.ESIntegTestCase.before(ESIntegTestCase.java:1953)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:497)  
at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1660)  
at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:900)  
at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:916)  
at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)  
....  
Caused by: java.lang.AssertionError  
at org.elasticsearch.common.path.PathTrie$TrieNode.insert(PathTrie.java:121)  
at org.elasticsearch.common.path.PathTrie.insert(PathTrie.java:203)  
at org.elasticsearch.rest.RestController.registerHandler(RestController.java:118)  
at org.elasticsearch.rest.action.search.RestSearchAction.(RestSearchAction.java:58)  
.....  
... 47 more  
[/code]

The same behavior repeats when I load the plugin onto a **MockNode**

```auto
Set<Class<? extends Plugin>> plugins = new HashSet<Class<? extends Plugin>>();
plugins.add(SearchIntelPlugin.class);
MockNode mockNode = new MockNode(nodeSettings, Version.CURRENT, plugins);
```

And similarly, if I use "\_cat", I get

```auto
 Error injecting constructor, java.lang.AssertionError
  at org.elasticsearch.rest.action.cat.RestCatAction.<init>(Unknown Source)
  while locating org.elasticsearch.rest.action.cat.RestCatAction
```

with the same stacktrace as above.

Is using an existing endpoint not possible for a plugin?  
And also, why does this error appear only for the embedded nodes, and not when used on the standalone cluster?

---

<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:** [July 5, 2017, 11:15pm UTC](https://discuss.elastic.co/t/es-2-2-plugin-with--search-endpoint-not-loading-in-embedded-node-due-to-assertionerror/41610/2 "2017-07-05T23:15:13Z")

</div>

Closed on July 5, 2017, 11:15pm UTC


