# Graph Algorithm - A\* algorithm returns java.lang.ArrayIndexOutOfBoundsException: -1

**URL:** <https://community.neo4j.com/t/graph-algorithm-a-algorithm-returns-java-lang-arrayindexoutofboundsexception-1/10179>\
**Category:** Graph Data Science / Graph Analytics\
**Tags:** neo4j-spatial\
**Created:** [September 17, 2019, 11:07am UTC](https://community.neo4j.com/t/graph-algorithm-a-algorithm-returns-java-lang-arrayindexoutofboundsexception-1/10179 "2019-09-17T11:07:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![howie.limu](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/howie.limu/32/3792_2.png) [@howie.limu](https://community.neo4j.com/u/howie.limu)\
**Post date:** [September 17, 2019, 11:07am UTC](https://community.neo4j.com/t/graph-algorithm-a-algorithm-returns-java-lang-arrayindexoutofboundsexception-1/10179/1 "2019-09-17T11:07:40Z")

</div>

Hey all, I'm trying to follow [this talk by Will Lyon and Craig Taverner](https://neo4j.com/graphconnect-2018/session/neo4j-spatial-mapping?_ga=2.33034494.1936822641.1566356737-2018928231.1544265149) - I've loaded an OSM Map extract using this [OSM Importer for Neo4j](https://github.com/neo4j-contrib/osm) and have managed to construct the routing graph and the point-of-interest graph. I'm now attempting to route by running the following query (essentially calling `algo.shortestPath.astar.stream` as mentioned in the talk):

```auto
MATCH (a:PointOfInterest) WHERE a.name = 'from_this_location'
MATCH (b:PointOfInterest) WHERE b.name = 'to_this_location'
CALL algo.shortestPath.astar.stream(a,b,'distance','lat','lon',{relationshipQuery:'ROUTE', nodeQuery:'Routable', direction:'BOTH', defaultValue:1.0})
YIELD nodeId, cost
MATCH (n) WHERE id(n)=nodeId
RETURN COLLECT({lat:n.location.latitude, lon:n.location.longitude}) AS route

```

However, the following error is returned:

```auto
Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure `algo.shortestPath.astar.stream`: Caused by: java.lang.ArrayIndexOutOfBoundsException: -1

```

I've tried this on the following docker images to no avail:

- Neo4j 3.5.5 Enterprise (with graph algorithms 3.5.7) and
- Neo4j 3.5.9 Enterprise (with graph algorithms 3.5.9)

Any idea what may be the issue - am I missing something or is this likely a bug?
