IllegalArgumentException: fromEdges and toEdges cannot be size > 1 at the same time when parsing europe.osm.pbf

java.lang.IllegalArgumentException: fromEdges and toEdges cannot be size > 1 at the same time
at com.graphhopper.reader.osm.RestrictionTopology.(RestrictionTopology.java:64)
at com.graphhopper.reader.osm.RestrictionTopology.way(RestrictionTopology.java:59)
at com.graphhopper.reader.osm.OSMRestrictionConverter.buildRestrictionTopologyForGraph(OSMRestrictionConverter.java:95)
at com.graphhopper.reader.osm.OSMReader.addRestrictionsToGraph(OSMReader.java:616)
at com.graphhopper.GraphHopper.importOSM(GraphHopper.java:933)

Hey team,

I’m using GraphHopper 10.0 with turn_costs: true and trying to import the Geofabrik Europe OSM PBF.

During import, it fails with this error:

IllegalArgumentException: fromEdges and toEdges cannot be size > 1 at the same time

Looks like it’s crashing on a turn restriction that has multiple from and to edges, which I assume isn’t supported by RestrictionTopology.

I tried running with 32GB of RAM and graph.dataaccess: MMAP, but it still fails. This is not even a memory issue is it?

Question: Is there a way to skip or sanitize these restrictions during import? Or do I need to pre-process the .osm.pbf myself to remove or fix these cases?

Any advice would be appreciated — thanks!

This would be a bug in GraphHopper. Can you share the exact timestamp, link or checksum for the Geofabrik file so I can try to reproduce this?

Normally turn restrictions GraphHopper does not handle are ignored automatically and the error you got should only occur if there is a bug in GraphHopper code. So you would have to change the code such that the restriction is ignored instead of an error being thrown.

Upgrade to GraphHopper 10.2, see here:

2 Likes