# \[8.3.2\] bin/elasticsearch-users throws StringIndexOutOfBoundsException

**URL:** <https://discuss.elastic.co/t/8-3-2-bin-elasticsearch-users-throws-stringindexoutofboundsexception/309794>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [July 16, 2022, 3:40pm UTC](https://discuss.elastic.co/t/8-3-2-bin-elasticsearch-users-throws-stringindexoutofboundsexception/309794 "2022-07-16T15:40:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerib](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerib/32/106584_2.png) [@gerib](https://discuss.elastic.co/u/gerib)\
**Post date:** [July 16, 2022, 3:40pm UTC](https://discuss.elastic.co/t/8-3-2-bin-elasticsearch-users-throws-stringindexoutofboundsexception/309794/1 "2022-07-16T15:40:06Z")

</div>

```auto
elasticsearch@esmaster:~/bin$ . elasticsearch-users useradd su -p password -r superuser
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: Range [13, 4) out of bounds for length 4
        at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
        at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
        at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
        at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
        at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
        at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
        at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4589)
        at java.base/java.lang.String.substring(String.java:2703)
        at java.base/java.lang.String.substring(String.java:2676)
        at org.elasticsearch.launcher.CliToolLauncher.getToolName(CliToolLauncher.java:77)
        at org.elasticsearch.launcher.CliToolLauncher.main(CliToolLauncher.java:57)

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 17, 2022, 11:32pm UTC](https://discuss.elastic.co/t/8-3-2-bin-elasticsearch-users-throws-stringindexoutofboundsexception/309794/2 "2022-07-17T23:32:57Z")

</div>

> [@gerib](#):
>
> `. elasticsearch-users useradd su -p password -r superuser`

Is that the actual command you are running? Why is there a `.` at the start?

---

<div class="post-metadata">

**Author:** ![gerib](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerib/32/106584_2.png) [@gerib](https://discuss.elastic.co/u/gerib)\
**Post date:** [July 19, 2022, 11:03am UTC](https://discuss.elastic.co/t/8-3-2-bin-elasticsearch-users-throws-stringindexoutofboundsexception/309794/3 "2022-07-19T11:03:15Z")

</div>

It is the actual command.

`elasticsearch-users` is a Bash script: [source or dot operator Man Page - Linux - SS64.com](https://ss64.com/bash/source.html) and I've seen right now that it doesn't pass any argument to `elasticsearch-cli`:

```auto
#!/bin/bash

# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License
# 2.0; you may not use this file except in compliance with the Elastic License
# 2.0.

CLI_LIBS="modules/x-pack-core,modules/x-pack-security"
source "`dirname "$0"`"/elasticsearch-cli

```

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [July 20, 2022, 6:21am UTC](https://discuss.elastic.co/t/8-3-2-bin-elasticsearch-users-throws-stringindexoutofboundsexception/309794/4 "2022-07-20T06:21:24Z")

</div>

You should run `elasticsearch-users` as an executable script, it is not intended to be sourced (via `.`)

---

<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:** [August 17, 2022, 6:22am UTC](https://discuss.elastic.co/t/8-3-2-bin-elasticsearch-users-throws-stringindexoutofboundsexception/309794/5 "2022-08-17T06:22:05Z")

</div>

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