{"record":{"id":"22cd9dbb6a6ee793","repo":"a-b-street/abstreet","slug":"doesn-t-point-to","errorCode":null,"errorMessage":"{} doesn't point to {}","messagePattern":"(.+?) doesn't point to (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"map_model/src/objects/road.rs","lineNumber":545,"sourceCode":"\n    /// Many roads wind up with almost no length, due to their representation in OpenStreetMap. In\n    /// reality, these segments are likely located within the interior of an intersection. This\n    /// method uses a hardcoded threshold to detect these cases.\n    pub fn is_extremely_short(&self) -> bool {\n        self.length() < Distance::meters(2.0)\n    }\n\n    /// Get the DirectedRoadID pointing to the intersection. Panics if the intersection isn't an\n    /// endpoint.\n    pub fn directed_id_from(&self, i: IntersectionID) -> DirectedRoadID {\n        DirectedRoadID {\n            road: self.id,\n            dir: if self.src_i == i {\n                Direction::Fwd\n            } else if self.dst_i == i {\n                Direction::Back\n            } else {\n                panic!(\"{} doesn't point to {}\", self.id, i);\n            },\n        }\n    }\n\n    /// Get the DirectedRoadID pointing from the intersection. Panics if the intersection isn't an\n    /// endpoint.\n    pub fn directed_id_to(&self, i: IntersectionID) -> DirectedRoadID {\n        let mut id = self.directed_id_from(i);\n        id.dir = id.dir.opposite();\n        id\n    }\n\n    pub(crate) fn recreate_lanes(&mut self, lane_specs_ltr: Vec<LaneSpec>) {\n        self.lanes.clear();\n\n        let total_width = lane_specs_ltr.iter().map(|x| x.width).sum();\n\n        let mut width_so_far = Distance::ZERO;","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/map_model/src/objects/road.rs#L527-L563","documentation":"This constructor builds a DirectedRoadID pointing away from intersection i, choosing Fwd if i is the source endpoint and Back if it's the destination. Panics when i is not an endpoint of the road, so no valid direction exists.","triggerScenarios":"Calling road.DirectedRoadID(i) (the constructor) with an IntersectionID that is neither road.src_i nor road.dst_i — e.g. from pathfinding expansion over wrong adjacency lists.","commonSituations":"Custom routing algorithms expanding directed roads from intersections; using intersection IDs from a different road after ID staleness.","solutions":["Ensure i comes from road.src_i or road.dst_i (or other_endpt results) before constructing.","Fix pathfinding adjacency so expansion only uses roads incident to the intersection.","Refresh IDs if the map was reloaded or regenerated."],"exampleFix":"// before\nlet dr = DirectedRoadID { road: r.id, dir: ??? };\n// after\nlet dr = r.DirectedRoadID(i); // only after asserting r.src_i == i || r.dst_i == i","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn directed_road_safe(road: &Road, i: IntersectionID) -> Option<DirectedRoadID> {\n    if road.src_i == i { Some(DirectedRoadID { road: road.id, dir: Direction::Fwd }) }\n    else if road.dst_i == i { Some(DirectedRoadID { road: road.id, dir: Direction::Back }) }\n    else { None }\n}","tryCatchPattern":null,"preventionTips":["Build pathfinding expansion from true intersection adjacency","Never reuse directed-road constructions across map versions","Assert endpoint relation in debug builds before constructing"],"tags":["graph","pathfinding","invariant","wrong-argument"],"backgroundTag":"invalid-argument-value","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"}