IndexOutOfBoundsException for Optimization API

I’m using the Route Editor to test the Route Optimization API. Unfortunately it throws an Internal Server Error after adding all my data (relations, services, vehicles). The error-message is not helpful at all unfortunately!

Here’s my problem description: https://gist.github.com/zuper-tom/182b68bbbbb38f7403d3522278f8ce86
The error looks like this:
{
“message”: “Internal Server Error”,
“hints”: [
{
“message”: “Index: 1, Size: 1”,
“details”: “class java.lang.IndexOutOfBoundsException”
}
]
}

Any ideas how to debug this problem?

Thanks
Tom

Verified my guess that the problem is caused by my relations. If I remove them the error doesn’t occur. Guessing by the error-message I thought it might be related to the number of ids specified for a relation, but specifying three ids didn’t help. Neither did removing all but one relations. Triple-checked the documentation and as far as I can see I do everything exactly as documented?

After reducing the problem description even further I found out that everything works fine if I specify just one relation “in_same_route”:

“relations”: [
{
“type”: “in_same_route”,
“ids”: [
“54850047-pickup”,
“54850047-delivery”,
“63040065-delivery”
]
}
]

Is there some undocumented requirement in order to use “in_sequence”?

Thanks a lot for reporting and already digging deeper into it. We’ll investigate this and of course improving the error message if it is just this!

Thanks for reporting this, @zuper-tom. It is fixed now! The strings “pickup” and “delivery” are used also in our special ids (see our doc how to set relations for shipments). It happened that the “delivery” string in your id within the context of relations made the system thinking that it needs to deal with a shipment (which involves two locations, a pickup and a delivery loaction) rather than an ordinary delivery service. Thus, it tries to get two activities/locations even there is only one. This causes this error.

1 Like

Thanks for that guys! Did you also deploy a new version of the Route Editor? It doesn’t work for me any longer, throwing a silent error in the Javascript console when I click “show problem”: leaflet.js?v=0.7.3:7 Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'. (tested with same code as posted above)

Should I create a new discussion for that? @stefan

Ok. No, we did not deploy a new version of the route editor. Actually, I cannot reproduce this issue. Which problem have you posted via the editor?

Please try a refresh and is the default example working for you?

Yes, also feel free to send us your problem e.g. via PM or email

Thanks guys, this only seems to happen after the previous problem failed to be parsed. (e.g. “lat” missing from an address) So not important at all… Refreshing the page solves the problem.

In case you want to reproduce the problem yourself: copy this problem, click “show problem” (Uncaught TypeError: Cannot read property 'lat' of null printed to the console). All other problems copied into editor will fail now with aforementioned error message (Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.)

2 Likes

Thanks - I can reproduce it and we’ll fix (currently only as lower priority)