a-b-street/abstreet · error
can't figure out PathRequest from
Error message
can't figure out PathRequest from {:?} to {:?} via {} What it means
get_trip_time_lower_bound computes a lower-bound trip duration from a PathRequest, but only when a pathfind-compatible route can be derived from the request's endpoint info. When the request's TripInfo has no path candidate (None), it cannot estimate a duration and bails with the start, end, and ongoing mode verb in the message.
Solutions
- Verify both endpoints are routable on the map for the requested mode before calling
- Handle the Err case by falling back to a full map.pathfind PathRequest or skipping the estimate
- Check that the map's pathfinder is built/initialized before this query
Example fix
// before
let lb = get_trip_time_lower_bound(map, &info)?;
// after
let lb = match get_trip_time_lower_bound(map, &info) {
Ok(t) => Some(t),
Err(_) => None, // fall back to full pathfind or skip
}; Defensive patterns
Strategy: try-catch
Validate before calling
let path_req = info.to_path_request(map, PathConstraints::Car);
if path_req.is_none() {
eprintln!("no routable path for {:?} -> {:?}", info.start, info.end);
} Type guard
fn has_path_candidate(info: &TripInfo) -> bool {
!matches!(info.to_path_request_map(), None)
} Try / catch
match get_trip_time_lower_bound(map, &info) {
Ok(t) => t,
Err(_) => map.pathfind(default_request).map(|p| p.estimate_duration(map, max_speed)).unwrap_or(f64::INFINITY),
} Prevention
- Pre-validate endpoints are on the map and routable for the mode
- Keep the map pathfinder built and up to date
- Fall back to a full pathfind when the lower-bound query fails
When it happens
Trigger: Calling get_trip_time_lower_bound with a PathRequest whose endpoint info yields no path (e.g. endpoints not routable under the request's PathConstraints or mode), such as off-map or disconnected endpoints.
Common situations: Requesting trips between buildings/edges the pathfinder cannot serve, importing scenarios with endpoints outside the map boundary, modes whose ongoing path lookup legitimately returns None.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of a-b-street/abstreet@0964f29315 (2026-09-13).
Data as JSON: /api/errors/538e343ab801131d.
Report an issue: GitHub.
Appendix: source
Thrown at sim/src/sim/queries.rs:443
.get_person(self.trips.trip_to_person(id).unwrap())
.unwrap();
let max_speed = match info.mode {
TripMode::Walk | TripMode::Transit => Some(person.ped_speed),
// TODO We should really search the vehicles and grab it from there
TripMode::Drive => None,
// Assume just one bike
TripMode::Bike => {
person
.vehicles
.iter()
.find(|v| v.vehicle_type == VehicleType::Bike)
.unwrap()
.max_speed
}
};
Ok(path.estimate_duration(map, max_speed))
}
None => bail!(
"can't figure out PathRequest from {:?} to {:?} via {}",
info.start,
info.end,
info.mode.ongoing_verb()
),
}
}
pub fn get_highlighted_people(&self) -> &Option<BTreeSet<PersonID>> {
&self.highlighted_people
}
/// Returns people / m^2. Roads have up to two sidewalks and intersections have many crossings
/// -- take the max density along any one.
pub fn get_pedestrian_density(
&self,
map: &Map,
) -> (BTreeMap<RoadID, f64>, BTreeMap<IntersectionID, f64>) {View on GitHub (pinned to 0964f29315)