{"record":{"id":"dce65058b6aabecc","repo":"a-b-street/abstreet","slug":"some-path-does-illegal-uber-turn","errorCode":null,"errorMessage":"Some path does illegal uber-turn: {} -> {} -> {}","messagePattern":"Some path does illegal uber-turn: (.+?) -> (.+?) -> (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"map_model/src/pathfind/v1.rs","lineNumber":803,"sourceCode":"                \"pathfind() returned path that warps {} from {:?} to {:?}\",\n                len, pair[0], pair[1]\n            );\n        }\n    }\n}\n\nfn validate_restrictions(map: &Map, steps: &[PathStep]) {\n    for triple in steps.windows(5) {\n        if let (PathStep::Lane(l1), PathStep::Lane(l2), PathStep::Lane(l3)) =\n            (triple[0], triple[2], triple[4])\n        {\n            let from = map.get_parent(l1);\n            let via = l2.road;\n            let to = l3.road;\n\n            for (dont_via, dont_to) in &from.complicated_turn_restrictions {\n                if via == *dont_via && to == *dont_to {\n                    panic!(\n                        \"Some path does illegal uber-turn: {} -> {} -> {}\",\n                        l1, l2, l3\n                    );\n                }\n            }\n        }\n    }\n}\n\nfn validate_zones(map: &Map, steps: &[PathStep], req: &PathRequest) {\n    let z1 = map.get_parent(req.start.lane()).get_zone(map);\n    let z2 = map.get_parent(req.end.lane()).get_zone(map);\n\n    for step in steps {\n        if let PathStep::Turn(t) | PathStep::ContraflowTurn(t) = step {\n            if map\n                .get_parent(t.src)\n                .access_restrictions","sourceCodeStart":785,"sourceCodeEnd":821,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/map_model/src/pathfind/v1.rs#L785-L821","documentation":"validate_restrictions verifies that a produced driving path does not perform a 'complicated turn restriction' banned on the map: going from road l1 via road l2 into road l3 where the origin road lists (dont_via, dont_to) in complicated_turn_restrictions. When the pathfinder emits such an illegal triple turn, Path::new panics. It guards the pathfinding cost function against ignoring turn restrictions.","triggerScenarios":"Path::new called on a driving path whose step sequence crosses a road pair (via, to) forbidden by from.complicated_turn_restrictions, typically when the pathfind graph failed to encode uber-turn restrictions after a map edit or import change.","commonSituations":"Hit when editing turn restrictions in the map editor, importing OSM data with complex no-U-turn style restrictions, or modifying the pathfind v1 graph edge construction.","solutions":["Verify the map's complicated_turn_restrictions are correctly encoded and that the pathfind graph applies them as edge penalties or exclusions","If a restriction was added by a recent edit, confirm the restriction is intentional and regenerate the map","Debug pathfind v1 to ensure restricted transitions are removed from the graph for driving requests","Report upstream with the map and route if it occurs on unedited maps"],"exampleFix":"// before\n// pathfinder graph omitted complicated turn restrictions\ngraph.add_edge(from, via_to, cost);\n// after\nif from.complicated_turn_restrictions.contains(&(via, to)) {\n    continue; // skip forbidden uber-turn transition\n}\ngraph.add_edge(from, via_to, cost);","handlingStrategy":"validation","validationCode":"fn violates_restriction(map: &Map, steps: &[PathStep]) -> bool {\n    steps.windows(5).any(|t| matches!(\n        (t[0], t[2], t[4]),\n        (PathStep::Lane(l1), PathStep::Lane(l2), PathStep::Lane(l3))\n            if map.get_parent(l1).complicated_turn_restrictions\n                .contains(&(l2.road, l3.road))\n    ))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After editing turn restrictions, re-run a few driving paths through the affected area","Ensure uber-turn restrictions are encoded in the pathfind graph, not just map data","Keep map imports and restriction data in sync"],"tags":["rust","pathfinding","turn-restrictions","panic"],"backgroundTag":"internal-invariant-violation","analyzedSha":"0964f29315820c91b171b585eb51e300164e9197","analyzedAt":"2026-09-13T18:02:03.421Z","contentChangedAt":"2026-09-13T18:02:03.421Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}