Hmbown/CodeWhale · info

Usage: /network default <allow|deny|prompt>

Error message

Usage: /network default <allow|deny|prompt>

What it means

Thrown when the `/network default` subcommand is called with no policy value. The default policy must be one of allow, deny, or prompt, and network_inner requires exactly one argument after `default`.

Solutions

  1. Supply a policy value: `/network default allow`, `/network default deny`, or `/network default prompt`
  2. Run `/network` to see current defaults and usage

Example fix

// before
/network default
// after
/network default prompt
Defensive patterns

Strategy: validation

Validate before calling

if (cmd === 'default' && parts.length === 0) {
  throw new Error('Usage: /network default <allow|deny|prompt>');
}

Try / catch

try { run('/network default'); } catch (e) { if (String(e).includes('default')) console.log('Supply a policy: allow, deny, or prompt'); }

Prevention

When it happens

Trigger: Running `/network default` with no argument.

Common situations: User intends to change the default network permission mode but omits the value, or types `/network default` expecting an interactive picker.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/c6dcb4076be55900. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/commands/groups/utility/network.rs:70

    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 73e0f67d83)