{"record":{"id":"8ac974cd50c63d78","repo":"Hmbown/CodeWhale","slug":"usage-codewhale-pet-serve","errorCode":null,"errorMessage":"Usage: codewhale pet serve","messagePattern":"Usage: codewhale pet serve","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":1748,"sourceCode":"    // resolved to danger-full-access skips PR_SET_NO_NEW_PRIVS (#5723), every\n    // other outcome keeps it.\n    let startup_sandbox_mode = resolve_startup_sandbox_mode_for_hardening();\n    crate::sandbox::process_hardening::apply_process_hardening(startup_sandbox_mode.as_deref());\n\n    if args.get(1).is_some_and(|arg| arg == \"pet\") {\n        let root = crate::tui::pet_watch::owner::directory()?;\n        match args.get(2).map(String::as_str) {\n            Some(\"serve\") if args.len() == 3 => {\n                return crate::tui::pet_watch::owner::serve(\n                    root,\n                    std::env::var(\"CODEWHALE_PET_PORT\")\n                        .ok()\n                        .map(|p| p.parse::<u16>())\n                        .transpose()?\n                        .unwrap_or(4633),\n                );\n            }\n            _ => anyhow::bail!(\"Usage: codewhale pet serve\"),\n        }\n    }\n\n    // ── Fatal-signal terminal guard (#5424) ───────────────────────────────\n    // Abort-class deaths (stack overflow, allocation failure, double panic)\n    // skip the panic hook AND every Drop guard, leaving mouse capture and\n    // the kitty keyboard stack leaking into the user's shell. A classic\n    // sigaction handler restores the terminal and stamps a marker before\n    // re-raising. Also before any threads exist.\n    crate::tui::ui::fatal_signal_guard::install_fatal_signal_guard();\n\n    // Set up process panic hook before anything else — writes crash dumps\n    // to ~/.deepseek/crashes/ even if the panic happens before tokio is up,\n    // and restores the terminal so a panicked TUI doesn't leave the user's\n    // shell stuck in alt-screen mode.\n    let orig_hook = std::panic::take_hook();\n    std::panic::set_hook(Box::new(move |panic_info| {\n        // Restore the terminal first so the panic message itself, plus the","sourceCodeStart":1730,"sourceCodeEnd":1766,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L1730-L1766","documentation":"The `pet` subcommand dispatches on its positional arguments; the `serve` pet action expects a specific argument shape (including an optional port). Any other pet subcommand or malformed argument list falls into the catch-all `_` arm and bails with a usage string.","triggerScenarios":"Running `codewhale pet` with an unrecognized sub-action, or `codewhale pet serve` arguments that fail to match the expected pattern (e.g. `serve` with an invalid extra token that doesn't parse as u16, or arguments in the wrong order).","commonSituations":"Typo in the pet subcommand name; passing flags the pet parser doesn't know; supplying a non-numeric port to serve; guessing subcommand syntax.","solutions":["Run `codewhale pet serve` exactly, optionally followed by a numeric port (defaults to 4633)","Check `codewhale --help` / `codewhale pet --help` for the valid subcommands","Quote or drop unexpected arguments so the match arm pattern succeeds"],"exampleFix":"// before\ncodewhale pet serve --port 5000\n// after\ncodewhale pet serve 5000","handlingStrategy":"validation","validationCode":"// only invoke the exact known form:\n// codewhale pet serve [PORT]  where PORT is a valid u16","typeGuard":null,"tryCatchPattern":"match result { Err(e) if e.to_string().starts_with(\"Usage: codewhale pet serve\") => { eprintln!(\"{}\", e); std::process::exit(2); }, other => other? }","preventionTips":["Pass the port as a bare positional u16, not a flag","Check subcommand spelling against help output","Wrap pet invocations in a script that validates the port argument"],"tags":["cli","usage","pet"],"backgroundTag":"invalid-cli-argument","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T21:17:16.096Z"}