{"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":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"crates/tui/src/commands/groups/utility/network.rs","lineNumber":56,"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":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/commands/groups/utility/network.rs#L38-L74","documentation":"Usage error from the `/network` slash command: the subcommands `allow`, `deny`, `remove`, and `forget` each require exactly one host argument. When the host argument is missing, the command bails with this usage string instead of mutating policy. No network policy state is changed.","triggerScenarios":"Running `/network allow`, `/network deny`, `/network remove`, or `/network forget` with no host token after the subcommand.","commonSituations":"Typing the command from memory and forgetting the host; tab-completion not offering a host; copy-pasting a truncated example.","solutions":["Supply the host: `/network allow api.deepseek.com`","Run `/network` bare or `/network list` to see current policy and valid forms","Check the full usage string at the bottom of the command's output"],"exampleFix":"// before\n/network allow\n\n// after\n/network allow api.deepseek.com","handlingStrategy":"validation","validationCode":"let tokens: Vec<&str> = raw.split_whitespace().collect();\nif matches!(tokens.first().copied(), Some(\"allow\" | \"deny\" | \"remove\" | \"forget\")) {\n    anyhow::ensure!(tokens.len() == 2, \"Usage: /network {} <host>\", tokens[0]);\n}","typeGuard":"fn host_edit_is_well_formed(tokens: &[&str]) -> bool {\n    matches!(tokens.first().copied(), Some(\"allow\" | \"deny\" | \"remove\" | \"forget\"))\n        && tokens.len() == 2\n}","tryCatchPattern":null,"preventionTips":["Autocomplete host subcommands in the UI to prevent bare invocations","Run /network list to inspect policy instead of guessing argument shapes"],"tags":["slash-command","network-policy","usage","cli"],"backgroundTag":"missing-command-argument","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}