{"record":{"id":"316087da13a40b28","repo":"Hmbown/CodeWhale","slug":"usage-network-command-host","errorCode":null,"errorMessage":"Usage: /network {command} <host>","messagePattern":"Usage: /network (.+?) <host>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/tui/src/commands/groups/utility/network.rs","lineNumber":55,"sourceCode":"    }\n}\n\nfn network_inner(arg: Option<&str>) -> anyhow::Result<String> {\n    let raw = arg.map(str::trim).unwrap_or(\"\");\n    if raw.is_empty() || raw.eq_ignore_ascii_case(\"list\") {\n        return list_policy();\n    }\n\n    let mut parts = raw.split_whitespace();\n    let Some(command) = parts.next() else {\n        return list_policy();\n    };\n    let command = command.to_ascii_lowercase();\n\n    match command.as_str() {\n        \"allow\" | \"deny\" | \"remove\" | \"forget\" => {\n            let Some(host_arg) = parts.next() else {\n                bail!(\"Usage: /network {command} <host>\");\n            };\n            if parts.next().is_some() {\n                bail!(\"Usage: /network {command} <host>\");\n            }\n            let host = normalize_host_arg(host_arg)?;\n            let edit = match command.as_str() {\n                \"allow\" => NetworkEdit::Allow,\n                \"deny\" => NetworkEdit::Deny,\n                _ => NetworkEdit::Remove,\n            };\n            update_host(edit, &host)\n        }\n        \"default\" => {\n            let Some(value) = parts.next() else {\n                bail!(\"Usage: /network default <allow|deny|prompt>\");\n            };\n            if parts.next().is_some() {\n                bail!(\"Usage: /network default <allow|deny|prompt>\");","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/commands/groups/utility/network.rs#L37-L73","documentation":"Usage error from the `/network` slash command: a host-taking subcommand (`allow`, `deny`, `remove`, or `forget`) was invoked without exactly one host argument — either the host was omitted or extra arguments followed it. Raised in `network_inner` (called by `network`), which parses the raw argument by whitespace. The command prints this usage line instead of silently guessing.","triggerScenarios":"Running `/network allow`, `/network deny`, `/network remove`, or `/network forget` with no host (`/network allow`) or with more than one trailing token (`/network allow example.com extra`).","commonSituations":"Typing the subcommand and forgetting the host; pasting a multi-token value like `example.com:443 proxy`; using `forget` as an alias while expecting `default`-style syntax (`/network forget` alone); thinking `list` needs a host.","solutions":["Supply exactly one host: `/network allow api.example.com` or `/network deny evil.dev`.","Remove extra tokens — hosts must be a single whitespace-free argument; quote-stripping is not performed.","Use `/network list` (or bare `/network`) to view the policy, and `/network default allow|deny|prompt` for the default posture — neither takes a host.","Check `/network` usage output for the accepted subcommand grammar."],"exampleFix":"// before\n/network allow\n// after\n/network allow api.example.com","handlingStrategy":"validation","validationCode":"// shell-side guard before invoking the command\nread -r sub host extra <<< \"$input\"\ncase \"$sub\" in\n  allow|deny|remove|forget) [ -n \"$host\" ] && [ -z \"$extra\" ] || echo \"Usage: /network $sub <host>\" ;;\nesac","typeGuard":null,"tryCatchPattern":"// the command returns CommandResult::error(err.to_string()) — display it as-is;\n// no retry: this is a usage error, correct the arguments and re-run.\nmatch result {\n  CommandResult::Error(msg) if msg.starts_with(\"Usage: /network\") => print_help(\"/network\"),\n  other => other,\n}","preventionTips":["Pass exactly one whitespace-free host token to allow/deny/remove/forget.","Don't paste port+host pairs with spaces; normalize to a single host token.","Use bare `/network` or `/network list` to inspect policy — no host needed.","Check the usage string in COMMAND_INFO for the accepted grammar before scripting the command."],"tags":["cli","usage","arguments","slash-command"],"backgroundTag":"missing-cli-argument","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}