a-b-street/abstreet · error
Invalid --color_scheme=
Error message
Invalid --color_scheme={}. Choices: {} What it means
The ColorSchemeChoice::parse function maps a user-supplied string (usually the --color_scheme CLI flag) to a ColorScheme by exact label match. If no choice label equals the input, it bails listing all valid choices.
Solutions
- Use one of the exact choices printed in the error message (run with --help or read the list).
- Fix the spelling/casing in your script or alias.
- If a scheme was renamed between versions, update the flag to the new label.
Example fix
// before ./game --color_scheme=nite // after ./game --color_scheme=night
Defensive patterns
Strategy: validation
Validate before calling
let valid: Vec<&str> = ColorSchemeChoice::choices().iter().map(|c| c.label.as_str()).collect();
if !valid.contains(&scheme.as_str()) {
bail!("--color_scheme must be one of: {}", valid.join(", "));
} Try / catch
let scheme = match ColorSchemeChoice::parse(&flag) {
Ok(s) => s,
Err(e) => { eprintln!("{e}"); std::process::exit(2); }
}; Prevention
- Copy the scheme name from the choices list in the error message
- Use tab-completion or a wrapper script for CLI flags
- Re-check flag names after upgrading the tool since choices may change
When it happens
Trigger: Launching any map_gui-based game/binary with --color_scheme set to a misspelled or unknown name, e.g. --color_scheme=dark instead of a defined scheme label.
Common situations: Typo in a command line, stale scripts referencing removed/renamed color schemes after upgrades, case mismatches.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- Bad --alerts= . Must be print|block|silence
- Initial panel outcome is
- invalid tab id
- URL doesn't seem to have query params
- You forgot to call initialize on SimFlags after parsing…
AI-assisted analysis of a-b-street/abstreet@0964f29315 (2026-09-13).
Data as JSON: /api/errors/bafce024c1b7aff6.
Report an issue: GitHub.
Appendix: source
Thrown at map_gui/src/colors.rs:56
pub fn choices() -> Vec<Choice<ColorSchemeChoice>> {
vec![
Choice::new("day mode", ColorSchemeChoice::DayMode),
Choice::new("night mode", ColorSchemeChoice::NightMode),
Choice::new("textured", ColorSchemeChoice::Textured),
Choice::new("classic", ColorSchemeChoice::ClassicDayMode),
Choice::new("LTN", ColorSchemeChoice::LTN),
]
}
pub fn parse(x: &str) -> Result<ColorSchemeChoice> {
let mut options = Vec::new();
for c in ColorSchemeChoice::choices() {
options.push(c.label.clone());
if c.label == x {
return Ok(c.data);
}
}
bail!(
"Invalid --color_scheme={}. Choices: {}",
x,
options.join(", ")
);
}
}
pub struct ColorScheme {
scheme: ColorSchemeChoice,
pub road_outlines: bool,
pub road_class_colors: bool,
pub show_buildings_in_minimap: bool,
// UI
pub panel_bg: Color,
pub inner_panel_bg: Color,
pub day_time_slider: Color,View on GitHub (pinned to 0964f29315)