{"record":{"id":"5481a40fdbab941a","repo":"a-b-street/abstreet","slug":"s-road-doesn-t-point-to-dst-i-at-all","errorCode":null,"errorMessage":"{:?}'s road doesn't point to dst_i at all","messagePattern":"(.+?)'s road doesn't point to dst_i at all","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"map_model/src/edits/compat.rs","lineNumber":238,"sourceCode":"        if let Some(obj) = cmd.remove(\"ChangeLaneType\") {\n            let obj: ChangeLaneType = serde_json::from_value(obj).unwrap();\n            let (r, idx) = obj.id.lookup(map)?;\n            let road = modified.entry(r).or_insert_with(|| map.get_r_edit(r));\n            if road.lanes_ltr[idx].lt != obj.orig_lt {\n                bail!(\"{:?} lane type has changed\", obj);\n            }\n            road.lanes_ltr[idx].lt = obj.lt;\n        } else if let Some(obj) = cmd.remove(\"ReverseLane\") {\n            let obj: ReverseLane = serde_json::from_value(obj).unwrap();\n            let (r, idx) = obj.l.lookup(map)?;\n            let dst_i = map.find_i_by_osm_id(obj.dst_i)?;\n            let road = modified.entry(r).or_insert_with(|| map.get_r_edit(r));\n            let edits_dir = if dst_i == map.get_r(r).dst_i {\n                Direction::Fwd\n            } else if dst_i == map.get_r(r).src_i {\n                Direction::Back\n            } else {\n                bail!(\"{:?}'s road doesn't point to dst_i at all\", obj);\n            };\n            if road.lanes_ltr[idx].dir == edits_dir {\n                bail!(\"{:?}'s road already points to dst_i\", obj);\n            }\n            road.lanes_ltr[idx].dir = edits_dir;\n        } else if let Some(obj) = cmd.remove(\"ChangeSpeedLimit\") {\n            let obj: ChangeSpeedLimit = serde_json::from_value(obj).unwrap();\n            let r = map.find_r_by_osm_id(obj.id)?;\n            let road = modified.entry(r).or_insert_with(|| map.get_r_edit(r));\n            if road.speed_limit != obj.old {\n                bail!(\"{:?} speed limit has changed\", obj);\n            }\n            road.speed_limit = obj.new;\n        } else if let Some(obj) = cmd.remove(\"ChangeAccessRestrictions\") {\n            let obj: ChangeAccessRestrictions = serde_json::from_value(obj).unwrap();\n            let r = map.find_r_by_osm_id(obj.id)?;\n            let road = modified.entry(r).or_insert_with(|| map.get_r_edit(r));\n            if road.access_restrictions != obj.old {","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/map_model/src/edits/compat.rs#L220-L256","documentation":"During compat upgrade of a ReverseLane command, the code determines which direction the edited road must point by comparing dst_i with the road's src_i/dst_i. If the destination intersection is not an endpoint of the road at all, the command's assumptions are broken relative to the current map and upgrade bails.","triggerScenarios":"Loading an old edit file whose ReverseLane references a road whose endpoints changed (road split/merged after map regeneration), so obj.dst_i matches neither get_r(r).dst_i nor src_i.","commonSituations":"Applying edits saved months ago to a freshly regenerated map where OSM geometry changes split or rewired roads; replaying edits across map versions.","solutions":["Remove the stale ReverseLane command from the edit JSON and re-apply the change manually.","Regenerate or use the map version the edit was created against.","Update the command's road/intersection IDs to match the current map topology."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify dst_i is an endpoint of the road before loading\nlet r = map.get_r(map.find_r_by_osm_id(cmd_id)?);\nlet ok = cmd.dst_i == r.src_i || cmd.dst_i == r.dst_i;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Re-verify road endpoints after every map regeneration before replaying edits.","Store the map name in each edit file and check it before loading.","Watch for road split/merge changes in OSM import diffs."],"tags":["edits","compatibility","topology"],"backgroundTag":"schema-validation-failed","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"}