{"record":{"id":"538e343ab801131d","repo":"a-b-street/abstreet","slug":"can-t-figure-out-pathrequest-from-to-via","errorCode":null,"errorMessage":"can't figure out PathRequest from {:?} to {:?} via {}","messagePattern":"can't figure out PathRequest from (.+?) to (.+?) via (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sim/src/sim/queries.rs","lineNumber":443,"sourceCode":"                    .get_person(self.trips.trip_to_person(id).unwrap())\n                    .unwrap();\n                let max_speed = match info.mode {\n                    TripMode::Walk | TripMode::Transit => Some(person.ped_speed),\n                    // TODO We should really search the vehicles and grab it from there\n                    TripMode::Drive => None,\n                    // Assume just one bike\n                    TripMode::Bike => {\n                        person\n                            .vehicles\n                            .iter()\n                            .find(|v| v.vehicle_type == VehicleType::Bike)\n                            .unwrap()\n                            .max_speed\n                    }\n                };\n                Ok(path.estimate_duration(map, max_speed))\n            }\n            None => bail!(\n                \"can't figure out PathRequest from {:?} to {:?} via {}\",\n                info.start,\n                info.end,\n                info.mode.ongoing_verb()\n            ),\n        }\n    }\n\n    pub fn get_highlighted_people(&self) -> &Option<BTreeSet<PersonID>> {\n        &self.highlighted_people\n    }\n\n    /// Returns people / m^2. Roads have up to two sidewalks and intersections have many crossings\n    /// -- take the max density along any one.\n    pub fn get_pedestrian_density(\n        &self,\n        map: &Map,\n    ) -> (BTreeMap<RoadID, f64>, BTreeMap<IntersectionID, f64>) {","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/sim/src/sim/queries.rs#L425-L461","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nlet lb = get_trip_time_lower_bound(map, &info)?;\n// after\nlet lb = match get_trip_time_lower_bound(map, &info) {\n    Ok(t) => Some(t),\n    Err(_) => None, // fall back to full pathfind or skip\n};","handlingStrategy":"try-catch","validationCode":"let path_req = info.to_path_request(map, PathConstraints::Car);\nif path_req.is_none() {\n    eprintln!(\"no routable path for {:?} -> {:?}\", info.start, info.end);\n}","typeGuard":"fn has_path_candidate(info: &TripInfo) -> bool {\n    !matches!(info.to_path_request_map(), None)\n}","tryCatchPattern":"match get_trip_time_lower_bound(map, &info) {\n    Ok(t) => t,\n    Err(_) => map.pathfind(default_request).map(|p| p.estimate_duration(map, max_speed)).unwrap_or(f64::INFINITY),\n}","preventionTips":["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"],"tags":["pathfinding","routing","simulation"],"backgroundTag":"resource-not-found","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"}