<p dir="auto">When running the following query:</p>
<div class="highlight highlight-source-cypher notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="FOREACH ( n0 IN [] | CREATE ()&lt;-[x:A]-(), ({n1:endNode(x).n2}) )"><pre class="notranslate"><span class="pl-k">FOREACH</span> ( <span class="pl-smi">n0</span> <span class="pl-k">IN</span> [] | <span class="pl-k">CREATE</span> ()<span class="pl-c1">&lt;-</span><span class="pl-k">[</span><span class="pl-smi">x</span><span class="pl-en"><span class="pl-k">:</span><span class="pl-en">A</span></span><span class="pl-k">]</span><span class="pl-c1">-</span>(), (<span class="pl-s1"><span class="pl-k">{</span><span class="pl-smi">n1</span><span class="pl-k">:</span><span class="pl-smi">endNode</span>(<span class="pl-smi">x</span>).<span class="pl-smi">n2</span><span class="pl-k">}</span></span>) )</pre></div>
<p dir="auto">I encountered the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Neo4jError: Neo.DatabaseError.Statement.ExecutionFailed (Index 3 out of bounds for length 0)"><pre class="notranslate"><code class="notranslate">Neo4jError: Neo.DatabaseError.Statement.ExecutionFailed (Index 3 out of bounds for length 0)
</code></pre></div>
<p dir="auto">I believe the query mentioned above is semantically and syntactically correct and thus no error should be thrown here.</p>
<p dir="auto">I encountered this issue when testing queries against the <strong>Neo4j 5.6.0 enterprise version</strong> in a Docker container running <strong>alpine v.3</strong>.<br>
While the error message is similar to the one from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1660869754" data-permission-text="Title is private" data-url="https://github.com/neo4j/neo4j/issues/13129" data-hovercard-type="issue" data-hovercard-url="/neo4j/neo4j/issues/13129/hovercard" href="https://github.com/neo4j/neo4j/issues/13129">#13129</a>, this bug only arises in the enterprise edition, while the one from the mentioned issue only triggers in the community edition.</p>
<h3 dir="auto">Steps to reproduce</h3>
<p dir="auto">Run the following queries and observe it throws an error:</p>
<div class="highlight highlight-source-cypher notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="FOREACH ( n0 IN [] | CREATE ()&lt;-[x:A]-(), ({n1:endNode(x).n2}) )"><pre class="notranslate"><span class="pl-k">FOREACH</span> ( <span class="pl-smi">n0</span> <span class="pl-k">IN</span> [] | <span class="pl-k">CREATE</span> ()<span class="pl-c1">&lt;-</span><span class="pl-k">[</span><span class="pl-smi">x</span><span class="pl-en"><span class="pl-k">:</span><span class="pl-en">A</span></span><span class="pl-k">]</span><span class="pl-c1">-</span>(), (<span class="pl-s1"><span class="pl-k">{</span><span class="pl-smi">n1</span><span class="pl-k">:</span><span class="pl-smi">endNode</span>(<span class="pl-smi">x</span>).<span class="pl-smi">n2</span><span class="pl-k">}</span></span>) )</pre></div>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">The query should run successfully</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">The query fails with the error message <code class="notranslate">Neo4jError: Neo.DatabaseError.Statement.ExecutionFailed (Index 3 out of bounds for length 0)</code></p>
<p dir="auto">Attempting to create a uniqueness constraint causes Neo4J to hang.</p>
<p dir="auto"><strong>Neo4j Version:</strong> 3.2.6<br>
<strong>Operating System:</strong> Ubuntu 16.04<br>
<strong>API:</strong> Cypher in web interface, also occurs from Py2Neo</p>
<h3 dir="auto">Steps to reproduce</h3>
<ol dir="auto">
<li>With new, empty graph, enter in web interface<br>
<code class="notranslate">CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE</code></li>
</ol>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Constraint should be created</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">Neo4J server hangs, apparently while trying to create an index. The request, and all other requests in the web interface, are just met with a spinner.<br>
From debug.log:</p>
<p dir="auto"><code class="notranslate">2017-10-12 13:29:17.245+0000 INFO [o.n.k.i.DiagnosticsManager] --- SERVER STARTED END --- 2017-10-12 13:29:56.701+0000 INFO [o.n.k.i.a.i.IndexPopulationJob] Index population started: [:Book(isbn) [provider: {key=lucene, version=1.0}]] 2017-10-12 13:29:57.088+0000 INFO [o.n.k.i.a.i.IndexPopulationJob] Completed node store scan. Flushing all pending updates. BatchingMultipleIndexPopulator{activeTasks=0, executor=java.util.concurrent.ThreadPoolExecutor@1cf9354b[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], batchedUpdates = [], queuedUpdates = 0} 2017-10-12 13:29:57.088+0000 INFO [o.n.k.i.a.i.IndexPopulationJob] Shutting down executor. BatchingMultipleIndexPopulator{activeTasks=0, executor=java.util.concurrent.ThreadPoolExecutor@1cf9354b[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], batchedUpdates = [], queuedUpdates = 0} 2017-10-12 13:51:15.551+0000 INFO [o.n.k.i.t.l.c.CheckPointerImpl] Check Pointing triggered by scheduler for time threshold [4]:  Starting check pointing... 2017-10-12 13:51:15.552+0000 INFO [o.n.k.i.t.l.c.CheckPointerImpl] Check Pointing triggered by scheduler for time threshold [4]:  Starting store flush...</code></p>
<p dir="auto">Discussed on <a href="https://stackoverflow.com/questions/46710894/uniqueness-constraint-causes-neo4j-to-hang" rel="nofollow">stackoverflow</a></p>