Hmbown/CodeWhale · error
expected resume command
Error message
expected resume command
What it means
Test assertion panic: parses 'codewhale resume abc123' and expects Commands::Resume so it can assert the session id and that the sessions footer points at 'codewhale resume'. The panic means the parsed command is not Commands::Resume.
Solutions
- Print the actual cli.command variant in the panic message.
- Confirm Commands::Resume still exists with session_id and last fields in that exact shape.
- Verify the clap subcommand is still named 'resume'.
- Rebuild the tui crate and rerun the sessions tests.
Example fix
// before
let Some(Commands::Resume { session_id, last }) = cli.command else {
panic!("expected resume command");
};
// after
let Some(Commands::Resume { session_id, last }) = cli.command else {
panic!("expected resume command, got {:?}", cli.command);
}; Defensive patterns
Strategy: validation
Validate before calling
assert!(matches!(cli.command, Commands::Resume { .. }), "got {:?}", cli.command); Type guard
fn as_resume(command: &Commands) -> Option<(Option<String>, bool)> {
match command {
Commands::Resume { session_id, last } => Some((session_id.clone(), *last)),
_ => None,
}
} Try / catch
let Some(Commands::Resume { session_id, last }) = cli.command else {
panic!("expected resume command, got {:?}", cli.command);
}; Prevention
- Update destructuring patterns when Resume fields change
- Test the sessions footer text against the real subcommand name
- Print the actual variant on failure
- Rename subcommand and tests atomically
When it happens
Trigger: parse_cli(&["codewhale","resume","abc123"]) returns a variant other than Commands::Resume { session_id, last }, so destructuring fails and the let-else panics.
Common situations: Resume subcommand renamed/removed; Resume variant fields changed shape so the pattern no longer matches; 'resume' absorbed into 'exec --continue'; stale test build.
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
- Expected Ok, got
- Expected Warning for relative path argument, got
- ApplyPatchPreflight should serialize
- bing result regex pattern is valid
- bing snippet regex pattern is valid
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/1a0507da6eaedd77.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/lib.rs:17355
"even the largest override stays finite"
);
}
#[test]
fn exec_accepts_continue_for_latest_workspace_session() {
let cli = parse_cli(&["codewhale", "exec", "--continue", "follow up"]);
let Some(Commands::Exec(args)) = cli.command else {
panic!("expected exec command");
};
assert!(args.continue_session);
}
#[test]
fn sessions_footer_points_to_resume_subcommand() {
let cli = parse_cli(&["codewhale", "resume", "abc123"]);
let Some(Commands::Resume { session_id, last }) = cli.command else {
panic!("expected resume command");
};
assert_eq!(session_id.as_deref(), Some("abc123"));
assert!(!last);
assert_eq!(sessions_resume_command(), "codewhale resume");
assert!(!sessions_resume_command().contains("--resume"));
}
#[test]
fn plugin_registry_initialization_precedes_dotenv_for_all_launch_paths() {
use std::cell::Cell;
#[derive(Clone, Copy)]
enum Expected {
Plain,
Resume,
Fork,
Exec,View on GitHub (pinned to 433685b202)