{"record":{"id":"7b62973ef65a21c1","repo":"a-b-street/abstreet","slug":"can-t-find-perma","errorCode":null,"errorMessage":"can't find {}","messagePattern":"can't find (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"map_model/src/edits/perma.rs","lineNumber":146,"sourceCode":"                }\n                Ok(EditCmd::ChangeRoad { r: id, new, old })\n            }\n            PermanentEditCmd::ChangeIntersection { i, new, old } => {\n                let id = map.find_i_by_osm_id(i)?;\n                Ok(EditCmd::ChangeIntersection {\n                    i: id,\n                    new: new\n                        .with_permanent(id, map)\n                        .with_context(|| format!(\"new ChangeIntersection of {} invalid\", i))?,\n                    old: old\n                        .with_permanent(id, map)\n                        .with_context(|| format!(\"old ChangeIntersection of {} invalid\", i))?,\n                })\n            }\n            PermanentEditCmd::ChangeRouteSchedule { gtfs_id, old, new } => {\n                let id = map\n                    .find_tr_by_gtfs(&gtfs_id)\n                    .ok_or_else(|| anyhow!(\"can't find {}\", gtfs_id))?;\n                Ok(EditCmd::ChangeRouteSchedule { id, old, new })\n            }\n        }\n    }\n}\n\nimpl MapEdits {\n    /// Encode the edits in a permanent format, referring to more-stable OSM IDs.\n    pub fn to_permanent(&self, map: &Map) -> PermanentMapEdits {\n        PermanentMapEdits {\n            map_name: map.get_name().clone(),\n            edits_name: self.edits_name.clone(),\n            // Increase this every time there's a schema change\n            version: 13,\n            proposal_description: self.proposal_description.clone(),\n            proposal_link: self.proposal_link.clone(),\n            commands: self.commands.iter().map(|cmd| cmd.to_perma(map)).collect(),\n        }","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/map_model/src/edits/perma.rs#L128-L164","documentation":"PermanentEditCmd::into_cmd converts a persisted, permanent edit into an EditCmd bound to a live Map. For ChangeRouteSchedule it resolves the GTFS route ID via map.find_tr_by_gtfs; if the map contains no matching transit route it errs with anyhow!(\"can't find {}\"). This catches edits made against a different/incompatible map.","triggerScenarios":"Loading a permanent edit JSON whose ChangeRouteSchedule references a gtfs_id not present in the current map — map regenerated, GTFS feed changed, or edit applied to the wrong map file.","commonSituations":"Applying saved edits after a map re-import with different route IDs; switching between cities/maps with the same edits file; GTFS feed updates removing or renumbering routes.","solutions":["Regenerate or update the edits file against the current map so gtfs_id values match","Verify you're loading edits into the same map they were created from","Remove the stale ChangeRouteSchedule entry from the edits JSON","Re-create the route-schedule edit in the GUI against the current map"],"exampleFix":"// before\nlet id = map.find_tr_by_gtfs(&gtfs_id).ok_or_else(|| anyhow!(\"can't find {}\", gtfs_id))?;\n// after\nlet id = map.find_tr_by_gtfs(&gtfs_id)\n    .with_context(|| format!(\"route {} not in this map; edits file may be stale — regenerate it\", gtfs_id))?;","handlingStrategy":"validation","validationCode":"// before applying edits\nif map.find_tr_by_gtfs(&gtfs_id).is_none() {\n    anyhow::bail!(\"edit references transit route {} absent from this map\", gtfs_id);\n}","typeGuard":null,"tryCatchPattern":"match perm.into_cmd(&map) {\n    Ok(cmd) => apply(cmd),\n    Err(e) if e.to_string().starts_with(\"can't find\") => prompt_stale_edits(e),\n    Err(e) => return Err(e),\n}","preventionTips":["Only apply edits files created from the same map version","Regenerate edits after map re-imports or GTFS feed updates","Store a map name/hash in the edits file and verify it before conversion"],"tags":["edits","map-model","transit","lookup"],"backgroundTag":"entity-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"}