# CSV river error (Error injecting constructor, ... String index out of range: 0)

**URL:** <https://discuss.elastic.co/t/csv-river-error-error-injecting-constructor-string-index-out-of-range-0/13406>\
**Category:** Elasticsearch\
**Created:** [August 30, 2013, 7:27am UTC](https://discuss.elastic.co/t/csv-river-error-error-injecting-constructor-string-index-out-of-range-0/13406 "2013-08-30T07:27:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_MacCarthy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justin_maccarthy/32/2020_2.png) [@Justin\_MacCarthy](https://discuss.elastic.co/u/Justin_MacCarthy)\
**Post date:** [August 30, 2013, 7:27am UTC](https://discuss.elastic.co/t/csv-river-error-error-injecting-constructor-string-index-out-of-range-0/13406/1 "2013-08-30T07:27:55Z")

</div>

I'm having an issue with the CSV I'm trying to figure out. I've included  
all the setup info and data below.

When I drop the csv into the /tmp/test directory I get the following error

[2013-08-30 12:01:17,148][INFO][gateway] [Spider-Slayer]  
recovered [1] indices into cluster\_state  
[2013-08-30 12:01:17,358][WARN][river] [Spider-Slayer]  
failed to create river [csv][my\_csv\_river]  
org.elasticsearch.common.inject.CreationException: Guice creation errors:

1. Error injecting constructor, java.lang.StringIndexOutOfBoundsException:  
String index out of range: 0  
at org.elasticsearch.river.csv.CSVRiver.(Unknown Source)  
while locating org.elasticsearch.river.csv.CSVRiver  
while locating org.elasticsearch.river.River

1 error  
at  
org.elasticsearch.common.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:344)  
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.InjectorImpl.createChildInjector(InjectorImpl.java:129)  
at  
org.elasticsearch.common.inject.ModulesBuilder.createChildInjector(ModulesBuilder.java:66)  
at org.elasticsearch.river.RiversService.createRiver(RiversService.java:138)  
at  
org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:270)  
at  
org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:264)  
at  
org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:87)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)  
at java.lang.Thread.run(Thread.java:680)  
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of  
range: 0  
at java.lang.String.charAt(String.java:686)  
at org.elasticsearch.river.csv.CSVRiver.(CSVRiver.java:86)  
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
at  
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)  
at  
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)  
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)  
at  
org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:54)  
at  
org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)  
at  
org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:98)  
at org.elasticsearch.common.inject.FactoryProxy.get(FactoryProxy.java:52)  
at  
org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:45)  
at  
org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:819)  
at  
org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:42)  
at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:57)  
at  
org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)  
at  
org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:200)  
at  
org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:193)  
at  
org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:812)  
at  
org.elasticsearch.common.inject.InjectorBuilder.loadEagerSingletons(InjectorBuilder.java:193)  
at  
org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:175)  
... 10 more

I've installed elasticsearch on osx using homebrew,

I cloned the csv river from here

> **[AgileWorksOrg/elasticsearch-river-csv](https://github.com/AgileWorksOrg/elasticsearch-river-csv)**
>
> elasticsearch-river-csv - CSV river for ElasticSearch

and built it with maven. I unzipped the river into

/usr/local/var/lib/elasticsearch/plugins/csv-river/

ls -la /usr/local/var/lib/elasticsearch/plugins/csv-river/

-rw-r--r-- 1 staff staff 12622 29 Aug 22:41  
elasticsearch-river-csv-1.0.1.jar  
-rw-r--r-- 1 staff staff 15347 29 Aug 22:23 opencsv-2.0.jar

and restarted ES, the plugin loads I think

elasticsearch -f -D  
es.config=/usr/local/opt/elasticsearch/config/elasticsearch.yml  
[2013-08-30 12:01:11,278][INFO][node] [Spider-Slayer]  
{0.90.2}[50307]: initializing ...  
[2013-08-30 12:01:11,291][INFO][plugins] [Spider-Slayer]  
loaded [river-csv], sites []

I setup the river with

curl -XPUT "[http://localhost:9200/\_river/my\_csv\_river/\_meta](http://localhost:9200/_river/my_csv_river/_meta)" -d'  
{  
"type" : "csv",  
"csv\_file" : {  
"folder" : "/tmp/test",  
"filename\_mask" : ".\*\.csv$",  
"poll":"5m",  
"fields" : [  
"column1",  
"column2",  
"column3",  
"column4"  
],  
"field\_separator" : ",",  
"escape\_character" : ";",  
"quote\_character" : ""  
},  
"index" : {  
"index" : "my\_csv\_data",  
"type" : "csv\_row",  
"bulk\_size" : 10000,  
"bulk\_threshold" : 50  
}  
}'

My test csv is as follows

a, b , c , d  
a, b , c , d

Any ideas ???

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Justin\_MacCarthy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justin_maccarthy/32/2020_2.png) [@Justin\_MacCarthy](https://discuss.elastic.co/u/Justin_MacCarthy)\
**Post date:** [August 30, 2013, 7:41am UTC](https://discuss.elastic.co/t/csv-river-error-error-injecting-constructor-string-index-out-of-range-0/13406/2 "2013-08-30T07:41:43Z")

</div>

I should mention the version of ES is "version" : "0.90.2"

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:18am UTC](https://discuss.elastic.co/t/csv-river-error-error-injecting-constructor-string-index-out-of-range-0/13406/3 "2017-07-06T02:18:49Z")

</div>


