a-b-street/abstreet · error
Don't know how to load
Error message
Don't know how to load {} What it means
load_synchronously dispatches on the `load` string: empty, a path containing /scenarios/, a scenario json, a save, etc. If none of the known patterns match, the loader has no strategy for the value and panics rather than guessing.
Solutions
- Check SimFlags::initialize / the load dispatch code for the accepted formats and use one
- Pass a full, correctly-suffixed path produced by the library's own path helpers (abstutil)
- Log the exact `load` value and compare against branches in load_synchronously
Example fix
// before flags.load = "some_mystery_file".to_string(); // after flags.initialize(map_name); // let the library compute a valid load path
Defensive patterns
Strategy: validation
Validate before calling
let load = &flags.load;
let recognized = load.is_empty()
|| load.contains("/scenarios/")
|| load.ends_with(".json");
if !recognized { eprintln!("unsupported load value: {}", load); } Try / catch
let result = std::panic::catch_unwind(|| flags.load_synchronously(&mut timer));
Prevention
- Build load paths with the library's own helpers (abstutil), not string concatenation
- Match the accepted patterns in load_synchronously before assigning flags.load
When it happens
Trigger: Setting SimFlags.load to an unrecognized string (or a path matching none of the expected suffixes like /scenarios/ or .json scenario/save conventions) and calling load_synchronously.
Common situations: Passing a raw map name where a full path is expected; typos in the load path; loading a custom file type the headless loader was never taught to handle.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- This build of A/B Street stores player data in…
- Can't find the data/ directory
- CityName::new( , ) has a country code that isn't two letters
- Couldn't read_json( )
- Couldn't read_binary
AI-assisted analysis of a-b-street/abstreet@0964f29315 (2026-09-13).
Data as JSON: /api/errors/fffa17ca4b33a477.
Report an issue: GitHub.
Appendix: source
Thrown at sim/src/make/load.rs:132
if opts.run_name == "unnamed" {
opts.run_name = scenario.scenario_name.clone();
}
let mut sim = Sim::new(&map, opts);
sim.instantiate(&scenario, &map, &mut rng, timer);
(map, sim, rng)
} else if self.load.contains("/raw_maps/") || self.load.contains("/maps/") {
info!("Loading map {}", self.load);
let map = Map::load_synchronously(self.load.clone(), timer);
timer.start("create sim");
let sim = Sim::new(&map, opts);
timer.stop("create sim");
(map, sim, rng)
} else {
panic!("Don't know how to load {}", self.load);
}
}
}
View on GitHub (pinned to 0964f29315)