a-b-street/abstreet · error
causes illegal entrance into a zone at
Error message
{} causes illegal entrance into a zone at {} What it means
validate_zones enforces access-restriction zones: a path may not cut through a road that allows through traffic for the request's mode and then enter a restricted zone that is neither the origin's nor destination's zone. When a turn in the produced path crosses into such a zone, Path::new panics. The source notes known false positives when part of the graph is separated from the rest by access-restricted roads.
Solutions
- Check whether the path legitimately must enter the restricted zone because the graph is disconnected otherwise — if so, it's a known false positive; extend the zone at map construction/edit time instead
- Adjust the access restrictions on the edited roads so the zone partition matches reality
- Fix the pathfind cost function to properly penalize/forbid restricted-zone crossings for the mode
- Report upstream if it reproduces on stock maps, including the PathRequest and turn ID
Example fix
// before
panic!("{} causes illegal entrance into a zone at {}", req, t);
// after
warn!("{} crosses into restricted zone at {}; allowing (known false positive)", req, t);
return Ok(path); // or extend the zone during map construction Defensive patterns
Strategy: validation
Validate before calling
fn enters_foreign_restricted_zone(map: &Map, steps: &[PathStep], req: &PathRequest) -> bool {
let z1 = map.get_parent(req.start.lane()).get_zone(map);
let z2 = map.get_parent(req.end.lane()).get_zone(map);
steps.iter().any(|s| match s {
PathStep::Turn(t) | PathStep::ContraflowTurn(t) => {
let z = map.get_parent(t.dst).get_zone(map);
z != z1 && z != z2
}
_ => false,
})
} Prevention
- When adding access restrictions, extend zones at map construction/edit time so disconnected regions are handled
- Test paths in areas partitioned by restricted roads to detect false positives
- Adjust or remove restrictions that fully seal off a graph region
When it happens
Trigger: Path::new called on a path whose turn enters a zone with access restrictions after leaving an unrestricted road, where the entered zone differs from both the start and end zones — common after map edits that add access restrictions (e.g. private roads, gates).
Common situations: Hit when editing access restrictions in the map editor or importing OSM access tags; the code comment acknowledges false positives when a graph region is only reachable through restricted roads.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- PathConstraints::from_lt
- Negative dist_ahead?!
- expected turn, but found
- modify_step broke total_length, it's now
- Empty path
AI-assisted analysis of a-b-street/abstreet@0964f29315 (2026-09-13).
Data as JSON: /api/errors/4acafde29ebf4aeb.
Report an issue: GitHub.
Appendix: source
Thrown at map_model/src/pathfind/v1.rs:837
if map
.get_parent(t.src)
.access_restrictions
.allow_through_traffic
.contains(req.constraints)
&& !map
.get_parent(t.dst)
.access_restrictions
.allow_through_traffic
.contains(req.constraints)
{
// Entering our destination zone is fine
let into_zone = map.get_parent(t.dst).get_zone(map);
if into_zone != z1 && into_zone != z2 {
// TODO There are lots of false positive here that occur when part of the graph
// is separated from the rest by access-restricted roads. Could maybe detect
// that here, or ideally even extend the zone at map construction time (or edit
// time) when that happens.
panic!("{} causes illegal entrance into a zone at {}", req, t);
}
}
}
}
}
View on GitHub (pinned to 0964f29315)