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

  1. Check SimFlags::initialize / the load dispatch code for the accepted formats and use one
  2. Pass a full, correctly-suffixed path produced by the library's own path helpers (abstutil)
  3. 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

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


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)