Hmbown/CodeWhale · warning · anyhow::Error
Usage: /network default <allow|deny|prompt>
Error message
Usage: /network default <allow|deny|prompt>
What it means
Usage error from the `/network default` subcommand: setting the default network policy requires one value of `allow`, `deny`, or `prompt`. With no value token present, the command bails with this usage string. The default policy is not modified.
Source
Thrown at crates/tui/src/commands/groups/utility/network.rs:71
match command.as_str() {
"allow" | "deny" | "remove" | "forget" => {
let Some(host_arg) = parts.next() else {
bail!("Usage: /network {command} <host>");
};
if parts.next().is_some() {
bail!("Usage: /network {command} <host>");
}
let host = normalize_host_arg(host_arg)?;
let edit = match command.as_str() {
"allow" => NetworkEdit::Allow,
"deny" => NetworkEdit::Deny,
_ => NetworkEdit::Remove,
};
update_host(edit, &host)
}
"default" => {
let Some(value) = parts.next() else {
bail!("Usage: /network default <allow|deny|prompt>");
};
if parts.next().is_some() {
bail!("Usage: /network default <allow|deny|prompt>");
}
update_default(value)
}
_ => bail!(usage()),
}
}
fn usage() -> &'static str {
"Usage: /network [list|allow <host>|deny <host>|remove <host>|default <allow|deny|prompt>]"
}
#[derive(Clone, Copy)]
enum NetworkEdit {
Allow,
Deny,View on GitHub (pinned to 0c42157ee5)
Solutions
- Provide the value: `/network default prompt`
- Use `/network` or `/network list` to view the current default instead of setting it
Example fix
// before /network default // after /network default prompt
Defensive patterns
Strategy: validation
Validate before calling
let tokens: Vec<&str> = raw.split_whitespace().collect();
if tokens.first().copied() == Some("default") {
anyhow::ensure!(tokens.len() == 2, "Usage: /network default <allow|deny|prompt>");
anyhow::ensure!(matches!(tokens[1], "allow" | "deny" | "prompt"), "invalid default value");
} Type guard
fn default_edit_is_well_formed(tokens: &[&str]) -> bool {
tokens.len() == 2 && matches!(tokens[1], "allow" | "deny" | "prompt")
} Prevention
- Remember default takes a tri-state value, not a host
- Use bare /network to read current state instead of setting it
When it happens
Trigger: Running `/network default` with no argument after the subcommand.
Common situations: Exploring the command's shape by running it bare; forgetting the tri-state value; expecting default to print the current value instead of setting it (use `/network` or `/network list` to read).
Related errors
- Usage: /network {command} <host>
- Usage: /network [list|allow <host>|deny <host>|remove <host>
- The Codewhale service returned an unexpectedly large respons
- Codewhale account login timed out; run `codewhale account lo
- The Codewhale service returned an account without an ID
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/c6dcb4076be55900.
Report an issue: GitHub.