{"record":{"id":"9a960a962ce09dee","repo":"zed-industries/zed","slug":"keystrokes-cannot-be-empty","errorCode":null,"errorMessage":"Keystrokes cannot be empty","messagePattern":"Keystrokes cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/keymap_editor/src/keymap_editor.rs","lineNumber":2761,"sourceCode":"            .filter(|args| !args.is_empty());\n\n        let value = action_arguments\n            .as_ref()\n            .map(|args| {\n                serde_json::from_str(args).context(\"Failed to parse action arguments as JSON\")\n            })\n            .transpose()?;\n\n        cx.build_action(action_name, value)\n            .context(\"Failed to validate action arguments\")?;\n        Ok(action_arguments)\n    }\n\n    fn validate_keystrokes(&self, cx: &App) -> anyhow::Result<Vec<KeybindingKeystroke>> {\n        let new_keystrokes = self\n            .keybind_editor\n            .read_with(cx, |editor, _| editor.keystrokes().to_vec());\n        anyhow::ensure!(!new_keystrokes.is_empty(), \"Keystrokes cannot be empty\");\n        Ok(new_keystrokes)\n    }\n\n    fn validate_context(&self, cx: &App) -> anyhow::Result<Option<String>> {\n        let new_context = self\n            .context_editor\n            .read_with(cx, |input, cx| input.text(cx));\n        let Some(context) = new_context.is_empty().not().then_some(new_context) else {\n            return Ok(None);\n        };\n        gpui::KeyBindingContextPredicate::parse(&context).context(\"Failed to parse key context\")?;\n\n        Ok(Some(context))\n    }\n\n    fn save_or_display_error(&mut self, cx: &mut Context<Self>) {\n        self.save(cx).map_err(|err| self.set_error(err, cx)).ok();\n    }","sourceCodeStart":2743,"sourceCodeEnd":2779,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/keymap_editor/src/keymap_editor.rs#L2743-L2779","documentation":"Validation in the keymap editor's validate_keystrokes: the keystroke editor produced an empty keystroke list, and a keybinding with no keystrokes is meaningless, so saving is rejected. This is a form-validation guard raised when the user clears the key sequence field and tries to save the binding.","triggerScenarios":"Thrown at crates/keymap_editor/src/keymap_editor.rs:2757 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Record at least one keystroke in the keybind editor before saving","If the goal is to remove a binding, delete the keybinding entry rather than saving an empty one"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}