a-b-street/abstreet · error
Edits are for , but this map is
Error message
Edits are for {:?}, but this map is {:?} What it means
Edits::load_from_file checks that the edit file's recorded map name city matches the loaded map's city before attempting to match commands. Only the city is compared (not the full name, since edits can apply across parts of a city); if they differ, the edits were made for a different map entirely.
Solutions
- Load the map for the city the edit file was created for (check the file's map_name field).
- Open the correct edit file belonging to the currently loaded map.
- If the city was intentionally renamed, edit the edit JSON's map_name.city to the new name.
Example fix
// before let edits = Edits::load(map, "data/player/edits/seattle.json"); // after: verify city first assert_eq!(map.get_name().city, "seattle"); let edits = Edits::load(map, "data/player/edits/seattle.json");
Defensive patterns
Strategy: validation
Validate before calling
// read the edit file and compare its city to the loaded map first
let v: serde_json::Value = serde_json::from_reader(file)?;
if v["map_name"]["city"] != serde_json::json!(map.get_name().city) {
bail!("edit file belongs to a different city");
} Prevention
- Name edit files after their map/city and keep them in matching directories.
- Check the map_name field before loading any edit file.
- Don't share edit files across cities.
When it happens
Trigger: Calling Edits::load_from_file (or load_from_bytes) with an edit JSON whose map_name.city differs from map.get_name().city — e.g. loading Seattle edits while a Philadelphia map is open.
Common situations: Opening the wrong city's edit file; copying edit files between map directories; renaming/re-importing a map under a different city name.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- access restrictions have changed
- can't find
- lane type has changed
- None of the edits apply to this map
- number of lanes in is ( fwd, back) now, but ( , ) in the…
AI-assisted analysis of a-b-street/abstreet@0964f29315 (2026-09-13).
Data as JSON: /api/errors/c6601ec23b6aaaad.
Report an issue: GitHub.
Appendix: source
Thrown at map_model/src/edits/mod.rs:222
/// Load map edits from a JSON file. Strip out any commands that're broken because they don't
/// match the current map. If the resulting edits are totally empty, consider that a failure --
/// the edits likely don't cover this map at all.
pub fn load_from_file(map: &Map, path: String, timer: &mut Timer) -> Result<MapEdits> {
let perma = match abstio::maybe_read_json::<PermanentMapEdits>(path.clone(), timer) {
Ok(perma) => perma,
Err(_) => {
// The JSON format may have changed, so attempt backwards compatibility.
let bytes = abstio::slurp_file(path)?;
let value = serde_json::from_slice(&bytes)?;
compat::upgrade(value, map)?
}
};
// Don't compare the full MapName; edits in one part of a city could apply to another. But
// make sure at least the city matches. Otherwise, we spend time trying to match up edits,
// and produce noisy logs along the way.
if map.get_name().city != perma.map_name.city {
bail!(
"Edits are for {:?}, but this map is {:?}",
perma.map_name.city,
map.get_name().city
);
}
let edits = perma.into_edits_permissive(map);
if edits.commands.is_empty() {
bail!("None of the edits apply to this map");
}
Ok(edits)
}
/// Load map edits from the given JSON bytes. Strip out any commands that're broken because
/// they don't match the current map. If the resulting edits are totally empty, consider that a
/// failure -- the edits likely don't cover this map at all.
pub fn load_from_bytes(map: &Map, bytes: Vec<u8>) -> Result<MapEdits> {
let perma = match abstutil::from_json::<PermanentMapEdits>(&bytes) {View on GitHub (pinned to 0964f29315)