CLI: --kinds silently drops invalid values and falls through to defaults
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start in crates/buzz-cli/src/commands/messages.rs at cmd_get_messages, around lines 372-377, and run the --kinds reproduction commands from the issue. Done means malformed values produce a usage error naming the invalid value, including when every value is invalid, while valid comma-separated kinds are passed through without falling back to defaults.
Written by the indexing model from the issue text.
Description
markdown
buzz messages get --kinds "abc,9" silently drops invalid kind values and returns results only for the valid ones. A user who types --kinds "9,abc" (typo, or unfamiliar kind string) gets kind-9 results with no warning that "abc" was ignored. The same applies when ALL values are invalid — the empty parsed list falls through and the default kinds are used instead, which is the opposite of what the user asked for.
Steps to reproduce
1. Run buzz messages get --channel <uuid> --kinds "abc,9" --format json
2. Observe: results are returned (only kind 9), no error or warning about "abc"
3. Run buzz messages get --channel <uuid> --kinds "abc" --format json
4. Observe: returns ALL default kinds (9, 40002, 40008, 45001, 45003) because the parsed list is empty and the if !kind_list.is_empty() guard falls through, leaving the original default kinds in place
Expected behavior
- If any value in --kinds fails to parse as a number, the command should return an error (exit code 1) naming the invalid value: invalid kind value in --kinds: "abc".
- Alternatively, a warning on stderr for each dropped value, though an error is safer — silent data loss from malformed input violates the CLI's agent-first contract where agents cannot inspect stderr interactively.
Actual behavior
Invalid kind values are silently dropped by filter_map(|s| s.trim().parse().ok()). If ALL values are invalid, the empty list falls through and the default kinds are used instead — the user asked for specific kinds and got the default instead, with no indication.
Version and platform
- Buzz CLI: current main as of 2026-08-27
- OS: any
Logs / additional context
The relevant code is in crates/buzz-cli/src/commands/messages.rs, cmd_get_messages, lines 372-377:
rust
if let Some(k) = kinds {
let kind_list: Vec<u64> = k.split(',').filter_map(|s| s.trim().parse().ok()).collect();
if !kind_list.is_empty() {
filter["kinds"] = serde_json::json!(kind_list);
}
}
The filter_map(... .ok()) silently discards parse failures. The if !kind_list.is_empty() guard means an entirely-invalid --kinds value reverts to the default kind set — the user asked for specific kinds and got the default instead, with no indication.
Suggested fix
Replace filter_map with a fallible parse that returns CliError::Usage on the first invalid value:
rust
if let Some(k) = kinds {
let kind_list: Vec<u64> = k.split(',')
.map(|s| s.trim().parse::<u64>()
.map_err(|_| CliError::Usage(format!("invalid kind value in --kinds: {:?}", s.trim()))))
.collect::<Result<, >>()?;
filter["kinds"] = serde_json::json!(kind_list);
}
- Dominant language
- Rust
- Stars
- 35.3k
- Forks
- 4.7k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 176
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from block/buzz
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
Mobile: opening an attachment names the file after the link text instead of the imeta filenamePossibly taken @wenhaoone claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Desktop: private project home channels show no lock icon in the sidebarPossibly taken @Bartok9 claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
buzz-pair: panics on wss:// relays — rustls CryptoProvider never installedPossibly taken @Bartok9 claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
Similar issues
-
area/cli parity
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
A-Picking A-UI C-Bug D-Trivial S-Ready-For-Implementation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bevyengine/bevy#26029 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
ai_p3 comp-protocols
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ClickHouse/ClickHouse#123884 ·
Maintainers usually reply within 1 day
-
state:needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
zed-industries/zed#65146 ·
Maintainers usually reply within 1 day