{"record":{"id":"48a39a782ad9c5df","repo":"xai-org/grok-build","slug":"unknown-key-notation-notation","errorCode":null,"errorMessage":"unknown key notation: <{notation}>","messagePattern":"unknown key notation: <(.+?)>","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/ptyctl/src/keys.rs","lineNumber":144,"sourceCode":"        \"f9\" => KeyCode::F(9),\n        \"f10\" => KeyCode::F(10),\n        \"f11\" => KeyCode::F(11),\n        \"f12\" => KeyCode::F(12),\n        \"lt\" => KeyCode::Char('<'),\n        \"gt\" => KeyCode::Char('>'),\n        \"bar\" => KeyCode::Char('|'),\n        \"bslash\" => KeyCode::Char('\\\\'),\n        s if s.len() == 1 => {\n            let c = s.chars().next().unwrap();\n            // For Shift+letter with no other modifiers, uppercase it (vim behavior).\n            if modifiers == KeyModifiers::SHIFT && c.is_ascii_alphabetic() {\n                modifiers = KeyModifiers::NONE;\n                KeyCode::Char(c.to_ascii_uppercase())\n            } else {\n                KeyCode::Char(c)\n            }\n        }\n        _ => bail!(\"unknown key notation: <{notation}>\"),\n    };\n\n    Ok(key(code, modifiers))\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_literal_text() {\n        let bytes = parse_keys(\"hello\").unwrap();\n        assert_eq!(bytes, b\"hello\");\n    }\n\n    #[test]\n    fn test_enter() {\n        let bytes = parse_keys(\"<CR>\").unwrap();","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/ptyctl/src/keys.rs#L126-L162","documentation":"parse_special() converts special key notations like <ctrl-a>, <enter>, <f1> into key events. Notations it doesn't recognize (and that aren't handled elsewhere in parse_to_events) raise this error.","triggerScenarios":"Passing a key string containing `<...>` whose inner text is not a supported special key (e.g. <command-a>, <hyper-x>, <foo>) to the keys command/API.","commonSituations":"Typo in a key name (<cntl-a> instead of <ctrl-a>); using platform-specific modifier names the parser doesn't know; copy-pasting notations from another tool's syntax.","solutions":["Use a supported notation, e.g. <ctrl-a>, <enter>, <esc>, <tab>, <f1>–<f12>","Fix typos like <cntl-a> → <ctrl-a>","Send plain characters without angle brackets for regular text","Check keys.rs parse_special for the exact list of accepted notations"],"exampleFix":"// before\nptyctl keys --name dev '<cntl-c>'\n// after\nptyctl keys --name dev '<ctrl-c>'","handlingStrategy":"validation","validationCode":"fn is_known_special(notation: &str) -> bool {\n    matches!(notation, \"enter\" | \"esc\" | \"tab\" | \"backspace\" | \"space\" | \"up\" | \"down\" | \"left\" | \"right\" | \"ctrl-a\" | \"ctrl-c\" | \"ctrl-d\")\n        || notation.starts_with(\"f\") // function keys\n}","typeGuard":null,"tryCatchPattern":"match parse_to_events(input) {\n    Ok(events) => send(events),\n    Err(e) if e.to_string().contains(\"unknown key notation\") => {\n        eprintln!(\"bad key spec; see docs for supported <...> notations\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep a cheat-sheet of supported <...> notations","Lint test scripts for common typos (<cntl vs <ctrl>)","Send plain characters for text, angle brackets only for special keys","Check keys.rs for the authoritative notation list"],"tags":["parsing","input","keys"],"backgroundTag":"invalid-key-notation","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}