Malformed or empty config.toml panics before argument parsing, so even zoo --help and zoo version are unavailable
Context: API Makeathon participant. Found while reviewing CLI startup.
The CLI unwraps configuration loading before it parses arguments: parse_default_config() is unwrapped at src/main.rs:187, and a prompt lookup is unwrapped at src/context.rs:243. Argument parsing only begins afterward (src/main.rs:191-193). A malformed TOML file, or a valid but empty config.toml that lacks an expected key, is an ordinary recoverable configuration error, not an invariant, but the unwrap turns it into a Rust panic.
Concrete failure
With a malformed or empty config.toml, every invocation panics, including recovery commands: zoo --help and zoo version cannot run, so a user cannot even discover how to point at a different config.
Verify
Point ZOO_CONFIG_DIR at a directory with a malformed TOML config, then at one with an empty TOML config. Both paths panic instead of returning a configuration diagnostic.
Suggested fix
Return a configuration error (with the file path and parse message) instead of unwrapping, and let argument parsing run first so --help and version remain usable when the config is broken.
Environment
Zoo CLI v0.2.184 (33534cd). Reviewed against the current main of KittyCAD/cli.
Malformed or empty
config.tomlpanics before argument parsing, so evenzoo --helpandzoo versionare unavailableContext: API Makeathon participant. Found while reviewing CLI startup.
The CLI unwraps configuration loading before it parses arguments:
parse_default_config()is unwrapped atsrc/main.rs:187, and apromptlookup is unwrapped atsrc/context.rs:243. Argument parsing only begins afterward (src/main.rs:191-193). A malformed TOML file, or a valid but emptyconfig.tomlthat lacks an expected key, is an ordinary recoverable configuration error, not an invariant, but the unwrap turns it into a Rust panic.Concrete failure
With a malformed or empty
config.toml, every invocation panics, including recovery commands:zoo --helpandzoo versioncannot run, so a user cannot even discover how to point at a different config.Verify
Point
ZOO_CONFIG_DIRat a directory with a malformed TOML config, then at one with an empty TOML config. Both paths panic instead of returning a configuration diagnostic.Suggested fix
Return a configuration error (with the file path and parse message) instead of unwrapping, and let argument parsing run first so
--helpandversionremain usable when the config is broken.Environment
Zoo CLI v0.2.184 (33534cd). Reviewed against the current
mainof KittyCAD/cli.