IllegalArgumentExceptionMapper during connecting to GH

Hello, I’m connecting to GH3 by ‘/route’ link from another app, which makes it by multiple threads.
Im using tools from that dependencies:



The body of the post request in GraphHopperWeb class (method ‘route’) is:

In the GH in ProfileResolver i ‘selectProfileCH’ method there are many profiles matching but I only want the ‘car’ profile.

I’ve got this exception:

INFO [2022-11-07 11:54:26,448] com.graphhopper.http.IllegalArgumentExceptionMapper: bad request: There are multiple CH profiles matching your request. Use the weighting,vehicle,turn_costs and/or u_turn_costs parameters to be more specific.
You can also try disabling CH altogether using ch.disable=true
requested: ||turn_costs=|u_turn_costs=
matched: [custom|car|turn_costs=false, custom|car|turn_costs=false, custom|car|turn_costs=false, custom|truck|turn_costs=false]
available: [custom|car|turn_costs=false, custom|car|turn_costs=false, custom|car|turn_costs=false, custom|truck|turn_costs=false]
You should consider using the profile parameter. The available profiles are: [car, no_motorway_car, no_toll_motorway_car, truck]
To learn more about profiles, see: docs/core/ "

And next logs are like:

"INFO [2022-11-07 11:54:27,811] com.graphhopper.resources.RouteResource: pl_PL okhttp/3.10.0 2, took: 696,0 ms, algo: , profile: car, weighting: , vehicle: , custom_model: null, alternatives: 1, distance0: 724298.153131912, weight0: 30995.728941336427, time0: 517min, points0: 0, debugInfo: idLookup:0.0772805s; , algoInit:22911 μs, dijkstrabi|ch-routing:310 ms, path extraction: 78831 μsvisited nodes sum: 517

Has anyone some clue why it is like this?

edit: I realized that my POST request from GraphHopperWeb.class takes the GET method in GH RouteResource.class. The problem is still current.

This seems a bit strange, because the request body contains "profile": "car" which normally should mean that the code in ProfileResolver should not run at all. Did you try to use a more recent version of the directions-api-client-hc dependency, like the most recent 6.2 for example?

would it work with GraphHopper 3.2 ?

Yes, it should, but maybe something is going wrong.

I just tried it myself: Starting a GH 3.2 server and sending a POST request with the body you pasted above. It works and the profile is recognized without invoking the ProfileResolver.

What confuses me is that you wrote:

And next logs are like:

Which would mean that somehow after you get the error the request is handled correctly. To me it looks like your request is working fine but there is another request that does not work simultaneously and that one likely is missing the profile parameter.

I think you are right. There is one request more, I have to find it in my app. Thank you, it very helped me. I was sure that there was sth wrong in that GH tools.

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